PHP code example of forknetwork / strict-phpunit

1. Go to this page and download the library: Download forknetwork/strict-phpunit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

forknetwork / strict-phpunit example snippets


use PHPUnit\Framework\TestCase;

class YourTest extends TestCase
{
    // ...
}

use ForkNetwork\StrictPHPUnit\StrictTestTrait;
use PHPUnit\Framework\TestCase;

class YourTest extends TestCase
{
    use StrictTestTrait;
    // ...
}

private function createFooMock()
{
    return $this->createMock('\Bar\Foo');
}

private function createFooMock()
{
    return $this->getMockBuilder('\Bar\Foo')
        ->enableAutoReturnValueGeneration();
        ->getMock();
}
xml
<rule ref="ForkNetwork.PHPUnit.StrictUnitTest">
    <properties>
        <property name="extendedClasses" type="array" value="TestCase,ExtendedTestCase,AnotherCustomTestCase"/>
    </properties>
</rule>