-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathAssertTest.php
41 lines (34 loc) · 1.25 KB
/
AssertTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
declare(strict_types=1);
namespace DMS\PHPUnitExtensions\ArraySubset\Tests\Unit;
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
final class AssertTest extends TestCase
{
public function testAssertArraySubsetPassesStrictConfig(): void
{
$this->expectException(ExpectationFailedException::class);
Assert::assertArraySubset(['bar' => 0], ['bar' => '0'], true);
}
public function testAssertArraySubsetThrowsExceptionForInvalidSubset(): void
{
$this->expectException(ExpectationFailedException::class);
Assert::assertArraySubset([6, 7], [1, 2, 3, 4, 5, 6]);
}
public function testAssertArraySubsetThrowsExceptionForInvalidSubsetArgument(): void
{
$this->expectException(Exception::class);
Assert::assertArraySubset('string', '');
}
public function testAssertArraySubsetThrowsExceptionForInvalidArrayArgument(): void
{
$this->expectException(Exception::class);
Assert::assertArraySubset([], '');
}
public function testAssertArraySubsetDoesNothingForValidScenario(): void
{
Assert::assertArraySubset([1, 2], [1, 2, 3]);
}
}