| @@ 94-114 (lines=21) @@ | ||
| 91 | self::assertSame($expected, Template::createFromString($template)->variableNames()); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function expectedVariableNames(): iterable |
|
| 95 | { |
|
| 96 | return [ |
|
| 97 | [ |
|
| 98 | 'template' => '', |
|
| 99 | 'expected' => [], |
|
| 100 | ], |
|
| 101 | [ |
|
| 102 | 'template' => '{foo}{bar}', |
|
| 103 | 'expected' => ['foo', 'bar'], |
|
| 104 | ], |
|
| 105 | [ |
|
| 106 | 'template' => '{foo}{foo:2}{+foo}', |
|
| 107 | 'expected' => ['foo'], |
|
| 108 | ], |
|
| 109 | [ |
|
| 110 | 'template' => '{bar}{foo}', |
|
| 111 | 'expected' => ['bar', 'foo'], |
|
| 112 | ], |
|
| 113 | ]; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @covers ::createFromString |
|
| @@ 122-142 (lines=21) @@ | ||
| 119 | self::assertSame($expected, (new UriTemplate($template))->getVariableNames()); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function expectedVariableNames(): iterable |
|
| 123 | { |
|
| 124 | return [ |
|
| 125 | [ |
|
| 126 | 'template' => '', |
|
| 127 | 'expected' => [], |
|
| 128 | ], |
|
| 129 | [ |
|
| 130 | 'template' => '{foo}{bar}', |
|
| 131 | 'expected' => ['foo', 'bar'], |
|
| 132 | ], |
|
| 133 | [ |
|
| 134 | 'template' => '{foo}{foo:2}{+foo}', |
|
| 135 | 'expected' => ['foo'], |
|
| 136 | ], |
|
| 137 | [ |
|
| 138 | 'template' => '{bar}{foo}', |
|
| 139 | 'expected' => ['bar', 'foo'], |
|
| 140 | ], |
|
| 141 | ]; |
|
| 142 | } |
|
| 143 | ||
| 144 | /** |
|
| 145 | * @covers ::expand |
|