Total Complexity | 2 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | abstract class AbstractAcl extends TestCase |
||
11 | { |
||
12 | abstract protected function createAcl(): Acl; |
||
13 | |||
14 | abstract public function providerRole(): iterable; |
||
15 | |||
16 | /** |
||
17 | * @dataProvider providerRole |
||
18 | */ |
||
19 | final public function testRole(string $role): void |
||
20 | { |
||
21 | $acl = $this->createAcl(); |
||
22 | $actual = $acl->show($role, false); |
||
23 | |||
24 | $file = "tests/data/acl/$role.php"; |
||
25 | $logFile = "logs/$file"; |
||
26 | |||
27 | $dir = dirname($logFile); |
||
28 | @mkdir($dir, 0o777, true); |
||
29 | $serialized = ve($actual, true); |
||
30 | file_put_contents( |
||
31 | $logFile, |
||
32 | <<<STRING |
||
33 | <?php |
||
34 | |||
35 | declare(strict_types=1); |
||
36 | |||
37 | return $serialized; |
||
38 | |||
39 | STRING |
||
40 | ); |
||
41 | |||
42 | self::assertFileExists($file, 'Expected file must exist on disk, fix it with: cp ' . $logFile . ' ' . $file); |
||
43 | |||
44 | $expected = require $file; |
||
45 | self::assertTrue($expected === $actual, 'File content does not match, compare with: meld ' . $file . ' ' . $logFile); |
||
46 | } |
||
47 | |||
48 | final public function testEverythingIsTranslated(): void |
||
54 | } |
||
55 | } |
||
56 |