| @@ 155-171 (lines=17) @@ | ||
| 152 | /** |
|
| 153 | * @test |
|
| 154 | */ |
|
| 155 | public function routeCollectionWillIncludeSeparateRoutesForSubPaths() |
|
| 156 | { |
|
| 157 | $pathDefinitions = (object)[ |
|
| 158 | '/a' => (object)['get' => (object)[]], |
|
| 159 | '/a/b' => (object)['get' => (object)[]], |
|
| 160 | '/a/b/c' => (object)['get' => (object)[]], |
|
| 161 | ]; |
|
| 162 | ||
| 163 | $this->documentMock |
|
| 164 | ->expects($this->any()) |
|
| 165 | ->method('getPathDefinitions') |
|
| 166 | ->willReturn($pathDefinitions); |
|
| 167 | ||
| 168 | $routes = $this->loader->load(self::DOCUMENT_PATH); |
|
| 169 | ||
| 170 | $this->assertCount(3, $routes); |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * @test |
|
| @@ 202-221 (lines=20) @@ | ||
| 199 | /** |
|
| 200 | * @test |
|
| 201 | */ |
|
| 202 | public function canUseXRouterMethodToOverrideMethod() |
|
| 203 | { |
|
| 204 | $pathDefinitions = (object)[ |
|
| 205 | '/a' => (object)[ |
|
| 206 | 'get' => (object)[], |
|
| 207 | 'post' => (object)['x-router-controller-method' => 'myMethodName'] |
|
| 208 | ], |
|
| 209 | '/b' => (object)['get' => (object)[]], |
|
| 210 | ]; |
|
| 211 | ||
| 212 | $this->documentMock |
|
| 213 | ->expects($this->any()) |
|
| 214 | ->method('getPathDefinitions') |
|
| 215 | ->willReturn($pathDefinitions); |
|
| 216 | ||
| 217 | $routes = $this->loader->load(self::DOCUMENT_PATH); |
|
| 218 | ||
| 219 | $actual = $routes->get('swagger.path.a.myMethodName'); |
|
| 220 | $this->assertNotNull($actual); |
|
| 221 | } |
|
| 222 | ||
| 223 | /** |
|
| 224 | * @test |
|
| @@ 309-325 (lines=17) @@ | ||
| 306 | /** |
|
| 307 | * @test |
|
| 308 | */ |
|
| 309 | public function routeCollectionWillIncludeSeparateRoutesForSubPathMethodCombinations() |
|
| 310 | { |
|
| 311 | $pathDefinitions = (object)[ |
|
| 312 | '/a' => (object)['get' => (object)[]], |
|
| 313 | '/a/b' => (object)['get' => (object)[], 'post' => (object)[]], |
|
| 314 | '/a/b/c' => (object)['put' => (object)[]], |
|
| 315 | ]; |
|
| 316 | ||
| 317 | $this->documentMock |
|
| 318 | ->expects($this->any()) |
|
| 319 | ->method('getPathDefinitions') |
|
| 320 | ->willReturn($pathDefinitions); |
|
| 321 | ||
| 322 | $routes = $this->loader->load(self::DOCUMENT_PATH); |
|
| 323 | ||
| 324 | $this->assertCount(4, $routes); |
|
| 325 | } |
|
| 326 | ||
| 327 | /** |
|
| 328 | * @test |
|