| Total Complexity | 7 |
| Total Lines | 412 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | final class Test extends TestCase |
||
| 8 | { |
||
| 9 | public function buttonProvider(): array |
||
| 10 | { |
||
| 11 | return [ |
||
| 12 | [ |
||
| 13 | 'test', |
||
| 14 | [ |
||
| 15 | 'before' => [ |
||
| 16 | 'inserted_test' => [ |
||
| 17 | 'href' => 'link', |
||
| 18 | 'show' => true, |
||
| 19 | ], |
||
| 20 | 'test' => [ |
||
| 21 | 'href' => 'link', |
||
| 22 | 'show' => true, |
||
| 23 | ], |
||
| 24 | 'test1' => [ |
||
| 25 | 'href' => 'link1', |
||
| 26 | 'show' => true, |
||
| 27 | ], |
||
| 28 | ], |
||
| 29 | 'after' => [ |
||
| 30 | 'test' => [ |
||
| 31 | 'href' => 'link', |
||
| 32 | 'show' => true, |
||
| 33 | ], |
||
| 34 | 'inserted_test' => [ |
||
| 35 | 'href' => 'link', |
||
| 36 | 'show' => true, |
||
| 37 | ], |
||
| 38 | 'test1' => [ |
||
| 39 | 'href' => 'link1', |
||
| 40 | 'show' => true, |
||
| 41 | ], |
||
| 42 | ], |
||
| 43 | 'child_of' => [ |
||
| 44 | 'test' => [ |
||
| 45 | 'href' => 'link', |
||
| 46 | 'show' => true, |
||
| 47 | 'sub_buttons' => [ |
||
| 48 | 'inserted_test' => [ |
||
| 49 | 'href' => 'link', |
||
| 50 | 'show' => true, |
||
| 51 | ], |
||
| 52 | ], |
||
| 53 | ], |
||
| 54 | 'test1' => [ |
||
| 55 | 'href' => 'link1', |
||
| 56 | 'show' => true, |
||
| 57 | ], |
||
| 58 | ], |
||
| 59 | ], |
||
| 60 | ], |
||
| 61 | [ |
||
| 62 | 'test1', |
||
| 63 | [ |
||
| 64 | 'before' => [ |
||
| 65 | 'test' => [ |
||
| 66 | 'href' => 'link', |
||
| 67 | 'show' => true, |
||
| 68 | ], |
||
| 69 | 'inserted_test1' => [ |
||
| 70 | 'href' => 'link', |
||
| 71 | 'show' => true, |
||
| 72 | ], |
||
| 73 | 'test1' => [ |
||
| 74 | 'href' => 'link1', |
||
| 75 | 'show' => true, |
||
| 76 | ], |
||
| 77 | ], |
||
| 78 | 'after' => [ |
||
| 79 | 'test' => [ |
||
| 80 | 'href' => 'link', |
||
| 81 | 'show' => true, |
||
| 82 | ], |
||
| 83 | 'test1' => [ |
||
| 84 | 'href' => 'link1', |
||
| 85 | 'show' => true, |
||
| 86 | ], |
||
| 87 | 'inserted_test1' => [ |
||
| 88 | 'href' => 'link', |
||
| 89 | 'show' => true, |
||
| 90 | ], |
||
| 91 | ], |
||
| 92 | 'child_of' => [ |
||
| 93 | 'test' => [ |
||
| 94 | 'href' => 'link', |
||
| 95 | 'show' => true, |
||
| 96 | ], |
||
| 97 | 'test1' => [ |
||
| 98 | 'href' => 'link1', |
||
| 99 | 'show' => true, |
||
| 100 | 'sub_buttons' => [ |
||
| 101 | 'inserted_test1' => [ |
||
| 102 | 'href' => 'link', |
||
| 103 | 'show' => true, |
||
| 104 | ], |
||
| 105 | ], |
||
| 106 | ], |
||
| 107 | ], |
||
| 108 | ], |
||
| 109 | ], |
||
| 110 | [ |
||
| 111 | 'dungeon', |
||
| 112 | [ |
||
| 113 | 'before' => [ |
||
| 114 | 'test' => [ |
||
| 115 | 'href' => 'link', |
||
| 116 | 'show' => true, |
||
| 117 | ], |
||
| 118 | 'test1' => [ |
||
| 119 | 'href' => 'link1', |
||
| 120 | 'show' => true, |
||
| 121 | ], |
||
| 122 | ], |
||
| 123 | 'after' => [ |
||
| 124 | 'test' => [ |
||
| 125 | 'href' => 'link', |
||
| 126 | 'show' => true, |
||
| 127 | ], |
||
| 128 | 'test1' => [ |
||
| 129 | 'href' => 'link1', |
||
| 130 | 'show' => true, |
||
| 131 | ], |
||
| 132 | ], |
||
| 133 | 'child_of' => [ |
||
| 134 | 'test' => [ |
||
| 135 | 'href' => 'link', |
||
| 136 | 'show' => true, |
||
| 137 | ], |
||
| 138 | 'test1' => [ |
||
| 139 | 'href' => 'link1', |
||
| 140 | 'show' => true, |
||
| 141 | ], |
||
| 142 | ], |
||
| 143 | ], |
||
| 144 | ], |
||
| 145 | ]; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @dataProvider buttonProvider |
||
| 150 | */ |
||
| 151 | public function testInsertButton(string $insertion_point, array $expected): void |
||
| 152 | { |
||
| 153 | foreach (['before', 'after', 'child_of'] as $where) |
||
| 154 | { |
||
| 155 | $haystack = [ |
||
| 156 | 'test' => [ |
||
| 157 | 'href' => 'link', |
||
| 158 | 'show' => true, |
||
| 159 | ], |
||
| 160 | 'test1' => [ |
||
| 161 | 'href' => 'link1', |
||
| 162 | 'show' => true, |
||
| 163 | ], |
||
| 164 | ]; |
||
| 165 | recursive_button( |
||
| 166 | [ |
||
| 167 | 'href' => 'link', |
||
| 168 | 'show' => true, |
||
| 169 | ], |
||
| 170 | $haystack, |
||
| 171 | $insertion_point, |
||
| 172 | $where, |
||
| 173 | 'inserted_' . $insertion_point |
||
| 174 | ); |
||
| 175 | $this->assertSame($expected[$where], $haystack); |
||
| 176 | } |
||
| 177 | } |
||
| 178 | |||
| 179 | public function childButtonProvider(): array |
||
| 363 | ], |
||
| 364 | ], |
||
| 365 | ], |
||
| 366 | ], |
||
| 367 | ], |
||
| 368 | ], |
||
| 369 | ]; |
||
| 370 | } |
||
| 371 | |||
| 372 | /** |
||
| 373 | * @dataProvider childButtonProvider |
||
| 374 | */ |
||
| 375 | public function testInsertChildButton(string $insertion_point, array $expected): void |
||
| 406 | } |
||
| 407 | } |
||
| 408 | |||
| 409 | public function testHook(): void |
||
| 421 |