Via Composer
$ composer require narrowspark/testing-helper
use Narrowspark\TestingHelper\Traits\AssertArrayTrait;
class ModelTest extends \PHPUnit_Framework_TestCase
{
use AssertArrayTrait;
// Now you can do something like this.
public function testIfArrayContainIrix()
{
$haystack = ['Mac', 'NT', 'Irix', 'Linux'];
self::assertInArray('Irix', $haystack);
}
// or
public function testAssertArraySubsetThrowsExceptionForInvalidSubset(): void
{
$this->expectException(ExpectationFailedException::class);
$this->assertArraySubset([6, 7], [1, 2, 3, 4, 5, 6]);
}
}
You need to run:
$ phpunit
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
The MIT License (MIT). Please see License File for more information.