|
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 Ecodev\Felix\Acl\Assertion\NamedAssertion; |
|
10
|
|
|
use EcodevTests\Felix\Traits\TestWithContainer; |
|
11
|
|
|
use PHPUnit\Framework\TestCase; |
|
12
|
|
|
|
|
13
|
|
|
class AllTest extends TestCase |
|
14
|
|
|
{ |
|
15
|
|
|
use TestWithContainer; |
|
16
|
|
|
|
|
17
|
|
|
protected function setUp(): void |
|
18
|
|
|
{ |
|
19
|
|
|
$this->createDefaultFelixContainer(); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @dataProvider providerAssert |
|
24
|
|
|
*/ |
|
25
|
|
|
public function testAssert(array $input, bool $expected): void |
|
26
|
|
|
{ |
|
27
|
|
|
$assertions = []; |
|
28
|
|
|
foreach ($input as $value) { |
|
29
|
|
|
$internalAssertion = $this->createMock(NamedAssertion::class); |
|
30
|
|
|
$internalAssertion->expects(self::atMost(1)) |
|
31
|
|
|
->method('assert') |
|
32
|
|
|
->willReturn($value); |
|
33
|
|
|
|
|
34
|
|
|
$assertions[] = $internalAssertion; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
$assertion = new All(...$assertions); |
|
38
|
|
|
|
|
39
|
|
|
$acl = $this->createMock(Acl::class); |
|
40
|
|
|
self::assertSame($expected, $assertion->assert($acl)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function providerAssert(): array |
|
44
|
|
|
{ |
|
45
|
|
|
return [ |
|
46
|
|
|
[[], true], |
|
47
|
|
|
[[true], true], |
|
48
|
|
|
[[true, true], true], |
|
49
|
|
|
[[true, false], false], |
|
50
|
|
|
[[false, true], false], |
|
51
|
|
|
[[false, false], false], |
|
52
|
|
|
[[false], false], |
|
53
|
|
|
]; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function testGetName(): void |
|
57
|
|
|
{ |
|
58
|
|
|
$assert1 = $this->createMock(NamedAssertion::class); |
|
59
|
|
|
$assert1->expects(self::once()) |
|
60
|
|
|
->method('getName') |
|
61
|
|
|
->willReturn('assert1'); |
|
62
|
|
|
|
|
63
|
|
|
$assert2 = $this->createMock(NamedAssertion::class); |
|
64
|
|
|
$assert2->expects(self::once()) |
|
65
|
|
|
->method('getName') |
|
66
|
|
|
->willReturn('assert2'); |
|
67
|
|
|
|
|
68
|
|
|
$assert = new All($assert1, $assert2); |
|
69
|
|
|
self::assertSame('assert1, et assert2', $assert->getName()); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths