PHP code example of loophp / phpunit-iterable-assertions
1. Go to this page and download the library: Download loophp/phpunit-iterable-assertions 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/ */
loophp / phpunit-iterable-assertions example snippets
namespace tests;
use loophp\PhpUnitIterableAssertions\Traits\IterableAssertions;
use PHPUnit\Framework\TestCase;
final class MyTest extends TestCase
{
use IterableAssertions;
$expected = range('a', 'c');
$actual = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
// This will fail: The keys are different.
self::assertIdenticalIterable(
$expected,
$actual
);
// This will succeed: Both iterables are different.
self::assertNotIdenticalIterable(
$expected,
$actual
);
}