Code Duplication    Length = 22-22 lines in 2 locations

tests/unit/Routing/OpenApiRouteLoader.php 2 locations

@@ 281-302 (lines=22) @@
278
    /**
279
     * @test
280
     */
281
    public function canUseXRouterControllerForDiKeyInPath()
282
    {
283
        $diKey    = 'my.x_router.controller';
284
        $expected = "$diKey:post";
285
        $this->decriptionMock
286
            ->expects($this->any())
287
            ->method('getPaths')
288
            ->willReturn([new Path('/a', [new Operation('/a:post', '/a', 'post')])]);
289
290
        $this->decriptionMock
291
            ->expects($this->atLeast(1))
292
            ->method('getExtension')
293
            ->willReturnCallback(function (string $name) use ($diKey) {
294
                return $name == 'router-controller' ? $diKey : null;
295
            });
296
297
        $routes = $this->loader->load(self::DOCUMENT_PATH);
298
299
        $actual = $routes->get('swagger.path.a.post');
300
        $this->assertNotNull($actual);
301
        $this->assertSame($expected, $actual->getDefault('_controller'));
302
    }
303
304
    /**
305
     * @test
@@ 307-328 (lines=22) @@
304
    /**
305
     * @test
306
     */
307
    public function canUseXRouterForDiKeyInPath()
308
    {
309
        $router   = 'my.x_router';
310
        $expected = "$router.a:post";
311
        $this->decriptionMock
312
            ->expects($this->any())
313
            ->method('getPaths')
314
            ->willReturn([new Path('/a', [new Operation('/a:post', '/a', 'post')])]);
315
316
        $this->decriptionMock
317
            ->expects($this->atLeast(1))
318
            ->method('getExtension')
319
            ->willReturnCallback(function (string $name) use ($router) {
320
                return $name == 'router' ? $router : null;
321
            });
322
323
        $routes = $this->loader->load(self::DOCUMENT_PATH);
324
325
        $actual = $routes->get('swagger.path.a.post');
326
        $this->assertNotNull($actual);
327
        $this->assertSame($expected, $actual->getDefault('_controller'));
328
    }
329
330
    /**
331
     * @test