| Total Complexity | 2 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class NoItemsCreateButtonUnitTest extends ListBuilderTestsBase |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Testing data provider |
||
| 17 | * |
||
| 18 | * @return array testing data |
||
| 19 | */ |
||
| 20 | public function actionsDataProvider(): array |
||
| 21 | { |
||
| 22 | return [ |
||
| 23 | // #0, the first case - without button |
||
| 24 | [ |
||
| 25 | function (): object { |
||
| 26 | // setup |
||
| 27 | unset($_GET['create-button']); |
||
| 28 | return new ListBuilder\Simple($this->getFields(), new FakeAdapter([])); |
||
| 29 | } |
||
| 30 | ], |
||
| 31 | // #1, the second case - without button, even if we try to display it |
||
| 32 | [ |
||
| 33 | function (): object { |
||
| 34 | // setup |
||
| 35 | $_GET['create-button'] = 1; |
||
| 36 | return new ListBuilder\Simple($this->getFields(), new FakeAdapter([])); |
||
| 37 | } |
||
| 38 | ], |
||
| 39 | ]; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Testing create button absence |
||
| 44 | * |
||
| 45 | * @param callable $setup |
||
| 46 | * setup method |
||
| 47 | * @dataProvider actionsDataProvider |
||
| 48 | */ |
||
| 49 | public function testCreateButtonAbsenceForEmptyList(callable $setup): void |
||
| 59 | } |
||
| 60 | } |
||
| 61 |