PHP code example of dms / phpunit-arraysubset-asserts
1. Go to this page and download the library: Download dms/phpunit-arraysubset-asserts 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/ */
dms / phpunit-arraysubset-asserts example snippets
namespace Your\Package\Tests;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use PHPUnit\Framework\TestCase;
final class ExampleTest extends TestCase
{
use ArraySubsetAsserts;
public function testWithTrait(): void
{
$expectedSubset = ['bar' => 0];
$content = ['bar' => '0'];
self::assertArraySubset($expectedSubset, $content, true);
$content = ['foo' => '1'];
$this->assertArraySubset($expectedSubset, $content, true);
}
}
namespace Your\Package\Tests;
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PHPUnit\Framework\TestCase;
final class ExampleTest extends TestCase
{
public function testWithDirectCall(): void
{
$expectedSubset = ['bar' => 0];
$content = ['bar' => '0'];
Assert::assertArraySubset($expectedSubset, $content, true);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.