| Total Complexity | 2 |
| Total Lines | 47 |
| 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 - without button |
||
| 20 | [ |
||
| 21 | function (): object { |
||
| 22 | // setup |
||
| 23 | unset($_GET['create-button']); |
||
| 24 | return new ListBuilder\Simple($this->getFields(), new FakeAdapter([])); |
||
| 25 | } |
||
| 26 | ], |
||
| 27 | // #1, the second case - without button, even if we try to display it |
||
| 28 | [ |
||
| 29 | function (): object { |
||
| 30 | // setup |
||
| 31 | $_GET['create-button'] = 1; |
||
| 32 | return new ListBuilder\Simple($this->getFields(), new FakeAdapter([])); |
||
| 33 | } |
||
| 34 | ], |
||
| 35 | ]; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Testing create button absence |
||
| 40 | * |
||
| 41 | * @param callable $setup |
||
| 42 | * setup method |
||
| 43 | * @dataProvider actionsDataProvider |
||
| 44 | */ |
||
| 45 | public function testCreateButtonAbsenceForEmptyList(callable $setup): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 |