@@ -33,10 +33,12 @@ public function testGetRouteCollectionForRequest()
33
33
34
34
public function testGetRouteByName ()
35
35
{
36
+
36
37
$ this ->route
37
38
->expects ($ this ->any ())
38
39
->method ('getPath ' )
39
- ->will ($ this ->returnValue ('/cms/routes/test-route ' ));
40
+ ->will ($ this ->returnValue ('/cms/routes/test-route ' ))
41
+ ;
40
42
41
43
$ this ->objectManager
42
44
->expects ($ this ->any ())
@@ -60,6 +62,54 @@ public function testGetRouteByName()
60
62
$ this ->assertEquals ('/cms/routes/test-route ' , $ foundRoute ->getPath ());
61
63
}
62
64
65
+ /**
66
+ * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
67
+ */
68
+ public function testGetRouteByNameNotFound ()
69
+ {
70
+ $ this ->objectManager
71
+ ->expects ($ this ->any ())
72
+ ->method ('find ' )
73
+ ->with (null , '/cms/routes/test-route ' )
74
+ ->will ($ this ->returnValue (null ))
75
+ ;
76
+
77
+ $ this ->managerRegistry
78
+ ->expects ($ this ->any ())
79
+ ->method ('getManager ' )
80
+ ->will ($ this ->returnValue ($ this ->objectManager ))
81
+ ;
82
+
83
+ $ routeProvider = new RouteProvider ($ this ->managerRegistry );
84
+ $ routeProvider ->setManagerName ('default ' );
85
+
86
+ $ routeProvider ->getRouteByName ('/cms/routes/test-route ' );
87
+ }
88
+
89
+ /**
90
+ * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
91
+ */
92
+ public function testGetRouteByNameNoRoute ()
93
+ {
94
+ $ this ->objectManager
95
+ ->expects ($ this ->any ())
96
+ ->method ('find ' )
97
+ ->with (null , '/cms/routes/test-route ' )
98
+ ->will ($ this ->returnValue ($ this ))
99
+ ;
100
+
101
+ $ this ->managerRegistry
102
+ ->expects ($ this ->any ())
103
+ ->method ('getManager ' )
104
+ ->will ($ this ->returnValue ($ this ->objectManager ))
105
+ ;
106
+
107
+ $ routeProvider = new RouteProvider ($ this ->managerRegistry );
108
+ $ routeProvider ->setManagerName ('default ' );
109
+
110
+ $ routeProvider ->getRouteByName ('/cms/routes/test-route ' );
111
+ }
112
+
63
113
public function testGetRoutesByNames ()
64
114
{
65
115
$ this ->markTestIncomplete ();
0 commit comments