https://phpunit.readthedocs.io/ru/latest/index.html
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
</phpunit>
Sample test
<?php declare(strict_types=1);
namespace Unit;
use app\good;
use phpDocumentor\Reflection\Types\This;
use PHPUnit\Framework\TestCase;
use function PHPUnit\Framework\assertSame;
final class goodTest extends TestCase
{
private $good;
protected function setUp(): void
{
$this->good=new good();
$this->good->setAge(33);
}
protected function tearDown(): void
{
}
/**
* @dataProvider goodProvider
* @return void
*/
public function testAge($age){
$this->assertEquals($age, $this->good->getAge());
}
public function goodProvider(){
return[
'one'=> [1],
'two'=> [2],
'three'=> [33]
];
}
public function testUser1(){
$age = 30;
assertSame(30, $age);
return 30;
}
/**
* @depends testUser1
* @param $user
* @return void
*/
public function testUser2($user){
assertSame($user, 30);
}
}