-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNotInArrayTest.php
More file actions
48 lines (42 loc) · 1.09 KB
/
NotInArrayTest.php
File metadata and controls
48 lines (42 loc) · 1.09 KB
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
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace SimpleSAML\Test\Assert;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Assert\Assert;
use SimpleSAML\Assert\AssertionFailedException;
/**
* Class \SimpleSAML\Assert\NotInArrayTest
*
* @package simplesamlphp/assert
*/
#[CoversClass(Assert::class)]
final class NotInArrayTest extends TestCase
{
/**
* @param boolean $shouldPass
* @param mixed $item
* @param array<mixed> $arr
*/
#[DataProvider('provideNotInArray')]
public function testnotInArray(bool $shouldPass, $item, array $arr): void
{
try {
Assert::notInArray($item, $arr);
$this->assertTrue($shouldPass);
} catch (AssertionFailedException $e) {
$this->assertFalse($shouldPass);
}
}
/**
* @return array<int, array{0: bool, 1: int, 2: array{0: int}}>
*/
public static function provideNotInArray(): array
{
return [
[true, 0, [1]],
[false, 1, [1]],
];
}
}