Total Complexity | 2 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | class ListBuilderNoItemsCreateButtonUnitTest extends ListBuilderTestsBase |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * Testing data provider |
||
13 | * |
||
14 | * @return array testing data |
||
15 | */ |
||
16 | public function actionsDataProvider(): array |
||
17 | { |
||
18 | return [ |
||
19 | // #0, the first case - empty listing |
||
20 | [ |
||
21 | function (): object { |
||
22 | // setup |
||
23 | unset($_GET['create-button']); |
||
24 | return new ListBuilder\Common($this->getFields(), new FakeAdapter([])); |
||
25 | }, |
||
26 | function ($result): void { |
||
27 | // asserting method |
||
28 | $this->assertStringNotContainsString('create-button"', $result); |
||
29 | } |
||
30 | ], |
||
31 | // #1, the second case - full header |
||
32 | [ |
||
33 | function (): object { |
||
34 | // setup |
||
35 | $_GET['create-button'] = 1; |
||
36 | return new ListBuilder\Common($this->getFields(), new FakeAdapter([])); |
||
37 | }, |
||
38 | function ($result): void { |
||
39 | // asserting method |
||
40 | $this->assertStringContainsString('../create/', $result); |
||
41 | } |
||
42 | ], |
||
43 | ]; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Testing create button absence |
||
48 | * |
||
49 | * * @dataProvider actionsDataProvider |
||
50 | */ |
||
51 | public function testCreateButtonAbsenceForEmptyList(callable $setup, callable $assertions): void |
||
61 | } |
||
62 | } |
||
63 |