1. Go to this page and download the library: Download fasano/phpunit-oop 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/ */
fasano / phpunit-oop example snippets
use Fasano\PhpUnitOop\TestSuite;
class SomeFeatureTest extends TestSuite
{
public static function cases(): array
{
return [
'Case name' => new MyCaseObject(...),
'Another case' => new AnotherCaseObject(...),
];
}
}
use Fasano\PhpUnitOop\TestCase;
class SuccessCase extends TestCase
{
public function __construct(
public readonly MyClass $object,
public readonly MyInput $input,
public readonly MyResult $result,
) {}
public function verify(): void
{
Assert::equals($this->result, $this->object->process($this->input));
}
}
use Fasano\PhpUnitOop\Assert;
Assert::true($condition);
Assert::false($condition);
Assert::equals($expected, $actual);
Assert::throws($exception, fn() => $this->dangerousOperation());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.