@@ -27,24 +27,22 @@ public function testPlaceholders()
27
27
'foo1 ' => '%foo ' ,
28
28
'foo2 ' => 'foo% ' ,
29
29
'foo3 ' => 'f%o%o ' ,
30
+ ), array (
31
+ 'foo ' => '%foo% ' ,
32
+ 'bar ' => '%bar% ' ,
33
+ 'foobar ' => 'foobar ' ,
34
+ 'foo1 ' => '%foo ' ,
35
+ 'foo2 ' => 'foo% ' ,
36
+ 'foo3 ' => 'f%o%o ' ,
30
37
)));
31
38
32
39
$ sc = $ this ->getServiceContainer ($ routes );
33
- $ sc
34
- ->expects ($ this ->at (1 ))
35
- ->method ('hasParameter ' )
36
- ->will ($ this ->returnValue (false ))
37
- ;
38
- $ sc
39
- ->expects ($ this ->at (2 ))
40
- ->method ('hasParameter ' )
41
- ->will ($ this ->returnValue (true ))
42
- ;
43
- $ sc
44
- ->expects ($ this ->at (3 ))
45
- ->method ('getParameter ' )
46
- ->will ($ this ->returnValue ('bar ' ))
47
- ;
40
+ $ sc ->expects ($ this ->at (1 ))->method ('hasParameter ' )->will ($ this ->returnValue (false ));
41
+ $ sc ->expects ($ this ->at (2 ))->method ('hasParameter ' )->will ($ this ->returnValue (true ));
42
+ $ sc ->expects ($ this ->at (3 ))->method ('getParameter ' )->will ($ this ->returnValue ('bar ' ));
43
+ $ sc ->expects ($ this ->at (4 ))->method ('hasParameter ' )->will ($ this ->returnValue (false ));
44
+ $ sc ->expects ($ this ->at (5 ))->method ('hasParameter ' )->will ($ this ->returnValue (true ));
45
+ $ sc ->expects ($ this ->at (6 ))->method ('getParameter ' )->will ($ this ->returnValue ('bar ' ));
48
46
49
47
$ router = new Router ($ sc , 'foo ' );
50
48
$ route = $ router ->getRouteCollection ()->get ('foo ' );
@@ -55,6 +53,13 @@ public function testPlaceholders()
55
53
$ this ->assertEquals ('%foo ' , $ route ->getDefault ('foo1 ' ));
56
54
$ this ->assertEquals ('foo% ' , $ route ->getDefault ('foo2 ' ));
57
55
$ this ->assertEquals ('f%o%o ' , $ route ->getDefault ('foo3 ' ));
56
+
57
+ $ this ->assertEquals ('%foo% ' , $ route ->getRequirement ('foo ' ));
58
+ $ this ->assertEquals ('bar ' , $ route ->getRequirement ('bar ' ));
59
+ $ this ->assertEquals ('foobar ' , $ route ->getRequirement ('foobar ' ));
60
+ $ this ->assertEquals ('%foo ' , $ route ->getRequirement ('foo1 ' ));
61
+ $ this ->assertEquals ('foo% ' , $ route ->getRequirement ('foo2 ' ));
62
+ $ this ->assertEquals ('f%o%o ' , $ route ->getRequirement ('foo3 ' ));
58
63
}
59
64
60
65
private function getServiceContainer (RouteCollection $ routes )
0 commit comments