1919use Ibexa \FieldTypeRichText \RichText \Converter \Link ;
2020use PHPUnit \Framework \TestCase ;
2121use Psr \Log \LoggerInterface ;
22+ use Symfony \Component \Routing \RouterInterface ;
2223
2324/**
2425 * Tests the Link converter
@@ -45,9 +46,9 @@ protected function getMockLocationService()
4546 /**
4647 * @return \PHPUnit\Framework\MockObject\MockObject
4748 */
48- protected function getMockUrlAliasRouter ()
49+ protected function getMockRouter ()
4950 {
50- return $ this ->createMock (UrlAliasRouter ::class);
51+ return $ this ->createMock (RouterInterface ::class);
5152 }
5253
5354 /**
@@ -119,18 +120,18 @@ public function testLink($input, $output)
119120
120121 $ contentService = $ this ->getMockContentService ();
121122 $ locationService = $ this ->getMockLocationService ();
122- $ urlAliasRouter = $ this ->getMockUrlAliasRouter ();
123+ $ router = $ this ->getMockRouter ();
123124
124125 $ contentService ->expects ($ this ->never ())
125126 ->method ($ this ->anything ());
126127
127128 $ locationService ->expects ($ this ->never ())
128129 ->method ($ this ->anything ());
129130
130- $ urlAliasRouter ->expects ($ this ->never ())
131+ $ router ->expects ($ this ->never ())
131132 ->method ($ this ->anything ());
132133
133- $ converter = new Link ($ locationService , $ contentService , $ urlAliasRouter );
134+ $ converter = new Link ($ locationService , $ contentService , $ router );
134135
135136 $ outputDocument = $ converter ->convert ($ inputDocument );
136137
@@ -215,7 +216,7 @@ public function testConvertLocationLink($input, $output, $locationId, $urlResolv
215216
216217 $ contentService = $ this ->getMockContentService ();
217218 $ locationService = $ this ->getMockLocationService ();
218- $ urlAliasRouter = $ this ->getMockUrlAliasRouter ();
219+ $ router = $ this ->getMockRouter ();
219220
220221 $ location = $ this ->createMock (APILocation::class);
221222
@@ -224,12 +225,12 @@ public function testConvertLocationLink($input, $output, $locationId, $urlResolv
224225 ->with ($ this ->equalTo ($ locationId ))
225226 ->willReturn ($ location );
226227
227- $ urlAliasRouter ->expects ($ this ->once ())
228+ $ router ->expects ($ this ->once ())
228229 ->method ('generate ' )
229230 ->with (UrlAliasRouter::URL_ALIAS_ROUTE_NAME , ['location ' => $ location ])
230231 ->willReturn ($ urlResolved );
231232
232- $ converter = new Link ($ locationService , $ contentService , $ urlAliasRouter );
233+ $ converter = new Link ($ locationService , $ contentService , $ router );
233234
234235 $ outputDocument = $ converter ->convert ($ inputDocument );
235236
@@ -320,7 +321,7 @@ public function testConvertBadLocationLink($input, $output, $locationId, $except
320321
321322 $ contentService = $ this ->getMockContentService ();
322323 $ locationService = $ this ->getMockLocationService ();
323- $ urlAliasRouter = $ this ->getMockUrlAliasRouter ();
324+ $ router = $ this ->getMockRouter ();
324325
325326 $ logger = $ this ->createMock (LoggerInterface::class);
326327
@@ -333,7 +334,7 @@ public function testConvertBadLocationLink($input, $output, $locationId, $except
333334 ->with ($ this ->equalTo ($ locationId ))
334335 ->will ($ this ->throwException ($ exception ));
335336
336- $ converter = new Link ($ locationService , $ contentService , $ urlAliasRouter , $ logger );
337+ $ converter = new Link ($ locationService , $ contentService , $ router , $ logger );
337338
338339 $ outputDocument = $ converter ->convert ($ inputDocument );
339340
@@ -419,7 +420,7 @@ public function testConvertContentLink($input, $output, $contentId, $urlResolved
419420
420421 $ contentService = $ this ->getMockContentService ();
421422 $ locationService = $ this ->getMockLocationService ();
422- $ urlAliasRouter = $ this ->getMockUrlAliasRouter ();
423+ $ router = $ this ->getMockRouter ();
423424
424425 $ contentInfo = $ this ->createMock (APIContentInfo::class);
425426 $ location = $ this ->createMock (APILocation::class);
@@ -439,12 +440,12 @@ public function testConvertContentLink($input, $output, $contentId, $urlResolved
439440 ->with ($ this ->equalTo ($ locationId ))
440441 ->willReturn ($ location );
441442
442- $ urlAliasRouter ->expects ($ this ->once ())
443+ $ router ->expects ($ this ->once ())
443444 ->method ('generate ' )
444445 ->with (UrlAliasRouter::URL_ALIAS_ROUTE_NAME , ['location ' => $ location ])
445446 ->willReturn ($ urlResolved );
446447
447- $ converter = new Link ($ locationService , $ contentService , $ urlAliasRouter );
448+ $ converter = new Link ($ locationService , $ contentService , $ router );
448449
449450 $ outputDocument = $ converter ->convert ($ inputDocument );
450451
@@ -535,7 +536,7 @@ public function testConvertBadContentLink($input, $output, $contentId, $exceptio
535536
536537 $ contentService = $ this ->getMockContentService ();
537538 $ locationService = $ this ->getMockLocationService ();
538- $ urlAliasRouter = $ this ->getMockUrlAliasRouter ();
539+ $ router = $ this ->getMockRouter ();
539540
540541 $ logger = $ this ->createMock (LoggerInterface::class);
541542
@@ -548,7 +549,7 @@ public function testConvertBadContentLink($input, $output, $contentId, $exceptio
548549 ->with ($ this ->equalTo ($ contentId ))
549550 ->will ($ this ->throwException ($ exception ));
550551
551- $ converter = new Link ($ locationService , $ contentService , $ urlAliasRouter , $ logger );
552+ $ converter = new Link ($ locationService , $ contentService , $ router , $ logger );
552553
553554 $ outputDocument = $ converter ->convert ($ inputDocument );
554555
0 commit comments