PHP code example of howtomakeaturn / easy-coverage

1. Go to this page and download the library: Download howtomakeaturn/easy-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/ */

    

howtomakeaturn / easy-coverage example snippets




namespace Tests\Coverage;

use PHPUnit\Framework\TestCase;
use Howtomakeaturn\EasyCoverage\EasyCoverage;

class CoverageTest extends TestCase
{
    public function testCoverage()
    {
        $coverage = new EasyCoverage();

        $coverage->erage->missingMethods());

            $msg = "You need to write tests for these $num methods: $str";

            $this->fail($msg);
        }
    }
}



namespace Tests\Unit;

use PHPUnit\Framework\TestCase;
use Howtomakeaturn\EasyCoverage\Target;

class SimpleTaskOneTest extends TestCase
{
    #[Target('App\Services\SimpleTaskOne@doSomething')]
    public function testBasicTest()
    {
        $task = new \App\Services\SimpleTaskOne();

        $task->doSomething();

        $this->assertTrue(true);
    }
}

    $coverage->alwaysIgnoreMethods([
        '__construct',
    ]);

    $coverage->ignoreClasses([
        'App\Services\LargeLegacyTask',
    ]);

    $coverage->ignoreClassMethods([
        'App\Services\SimpleTaskTwo@doSomething',
    ]);