This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-18
lines changed Expand file tree Collapse file tree 3 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -213,14 +213,10 @@ public function getReferringAutoRoutes($contentDocument)
213
213
*/
214
214
public function findRouteForUri ($ uri , UriContext $ uriContext )
215
215
{
216
- $ path = $ this ->getPathFromUri ($ uri );
217
- $ document = $ this ->dm ->find (null , $ path );
218
-
219
- if ($ document instanceof AutoRouteInterface) {
220
- return $ document ;
221
- }
222
-
223
- return null ;
216
+ return $ this ->dm ->find (
217
+ 'Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface ' ,
218
+ $ this ->getPathFromUri ($ uri )
219
+ );
224
220
}
225
221
226
222
private function getPathFromUri ($ uri )
Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
3
4
+ dev-master
5
+ ----------
6
+
7
+ * Convert non-managed intermediate nodes into AutoRoute documents #165
8
+
4
9
1.0.0
5
10
-----
6
11
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ public function provideCompareRouteContent()
184
184
public function testCompareRouteContent ($ isMatch )
185
185
{
186
186
$ this ->route ->getContent ()->willReturn ($ this ->contentDocument );
187
- $ content = $ isMatch ? $ this ->contentDocument : $ this ->contentDocument2 ;
187
+ $ isMatch ? $ this ->contentDocument : $ this ->contentDocument2 ;
188
188
189
189
$ this ->adapter ->compareAutoRouteContent ($ this ->route ->reveal (), $ this ->contentDocument );
190
190
}
@@ -203,17 +203,9 @@ public function testFindRouteForUri()
203
203
$ uri = '/this/is/uri ' ;
204
204
$ expectedRoute = $ this ->route ->reveal ();
205
205
206
- $ this ->dm ->find (null , $ this ->baseRoutePath . $ uri )->willReturn ($ expectedRoute );
206
+ $ this ->dm ->find (' Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface ' , $ this ->baseRoutePath . $ uri )->willReturn ($ expectedRoute );
207
207
208
208
$ res = $ this ->adapter ->findRouteForUri ($ uri , $ this ->uriContext ->reveal ());
209
209
$ this ->assertSame ($ expectedRoute , $ res );
210
210
}
211
-
212
- public function testFindRouteForUriShouldReturnNullWhenNodeAtGivenPathIsNotAnAutoRoute ()
213
- {
214
- $ uri = '/this/is/uri ' ;
215
- $ genericNode = $ this ->prophesize ('Doctrine\ODM\PHPCR\Document\Generic ' );
216
- $ this ->dm ->find (null , $ this ->baseRoutePath . $ uri )->willReturn ($ genericNode );
217
- $ this ->assertNull ($ this ->adapter ->findRouteForUri ($ uri , $ this ->uriContext ->reveal ()));
218
- }
219
211
}
You can’t perform that action at this time.
0 commit comments