Passed
Branch master (12b762)
by Adrien
08:14
created

AllTest::providerAssert()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix\Acl\Assertion;
6
7
use Ecodev\Felix\Acl\Acl;
8
use Ecodev\Felix\Acl\Assertion\All;
9
use Laminas\Permissions\Acl\Assertion\AssertionInterface;
10
use PHPUnit\Framework\TestCase;
11
12
class AllTest extends TestCase
13
{
14
    /**
15
     * @dataProvider providerAssert
16
     */
17
    public function testAssert(array $input, bool $expected): void
18
    {
19
        $assertions = [];
20
        foreach ($input as $value) {
21
            $internalAssertion = $this->createMock(AssertionInterface::class);
22
            $internalAssertion->expects(self::atMost(1))
23
                ->method('assert')
24
                ->willReturn($value);
25
26
            $assertions[] = $internalAssertion;
27
        }
28
29
        $assertion = new All(...$assertions);
30
31
        $acl = $this->createMock(Acl::class);
32
        self::assertSame($expected, $assertion->assert($acl));
33
    }
34
35
    public function providerAssert(): array
36
    {
37
        return [
38
            [[], true],
39
            [[true], true],
40
            [[true, true], true],
41
            [[true, false], false],
42
            [[false, true], false],
43
            [[false, false], false],
44
            [[false], false],
45
        ];
46
    }
47
}
48