PHP code example of ancarda / high-test-coverage

1. Go to this page and download the library: Download ancarda/high-test-coverage 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/ */

    

ancarda / high-test-coverage example snippets




use Ancarda\HighTestCoverage\RandomInt\RandomInt;

final class Genie
{
    public function __construct(private RandomInt $randomInt) {}

    public function fortune(): string
    {
        return 'Your lucky number is ' . $this->randomInt(1, 10);
    }
}



use Ancarda\HighTestCoverage\RandomInt\Fixed;

final class GenieTest extends TestCase
{
    public function testFortune(): void
    {
        $genie = new Genie(new Fixed(42));
        self::assertSame('Your lucky number is 42', $genie->fortune());
    }
}