1. Go to this page and download the library: Download holgerk/assert-golden 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/ */
holgerk / assert-golden example snippets
assertGolden(
null, // <- expectation value
['color' => 'golden'] // <- actual value
);
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
use Holgerk\AssertGolden\AssertGolden;
class ExampleTest extends TestCase
{
use AssertGolden;
#[Test]
public function test(): void
{
// via method call...
$this->assertGolden(
null,
['a' => 1, 'b' => 2]
);
// ...or static call
self::assertGolden(
null,
['a' => 1, 'b' => 2]
);
}
}
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
use function Holgerk\AssertGolden\assertGolden;
class ExampleTest extends TestCase
{
#[Test]
public function test(): void
{
assertGolden(
null,
['a' => 1, 'b' => 2]
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.