@@ -112,7 +112,7 @@ public function testRelativeUrlWithExtraParameters(string $expectedQueryString,
112
112
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing ' ));
113
113
$ url = $ this ->getGenerator ($ routes )->generate ('test ' , [$ parameter => $ value ], UrlGeneratorInterface::ABSOLUTE_PATH );
114
114
115
- $ this ->assertSame (sprintf ('/app.php/testing? %s ' , $ expectedQueryString ), $ url );
115
+ $ this ->assertSame (sprintf ('/app.php/testing%s ' , $ expectedQueryString ), $ url );
116
116
}
117
117
118
118
/**
@@ -123,7 +123,7 @@ public function testAbsoluteUrlWithExtraParameters(string $expectedQueryString,
123
123
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing ' ));
124
124
$ url = $ this ->getGenerator ($ routes )->generate ('test ' , [$ parameter => $ value ], UrlGeneratorInterface::ABSOLUTE_URL );
125
125
126
- $ this ->assertSame (sprintf ('http://localhost/app.php/testing? %s ' , $ expectedQueryString ), $ url );
126
+ $ this ->assertSame (sprintf ('http://localhost/app.php/testing%s ' , $ expectedQueryString ), $ url );
127
127
}
128
128
129
129
public function valuesProvider (): array
@@ -135,24 +135,18 @@ public function valuesProvider(): array
135
135
$ nestedStdClass ->nested = $ stdClass ;
136
136
137
137
return [
138
- 'string ' => ['foo=bar ' , 'foo ' , 'bar ' ],
139
- 'boolean-false ' => ['foo=0 ' , 'foo ' , false ],
140
- 'boolean-true ' => ['foo=1 ' , 'foo ' , true ],
141
- 'object implementing __toString() ' => ['foo=bar ' , 'foo ' , new StringableObject ()],
142
- 'object implementing __toString() in nested array ' => ['foo%5Bbaz%5D=bar ' , 'foo ' , ['baz ' => new StringableObject ()]],
143
- 'stdClass ' => ['foo%5Bbaz%5D=bar ' , 'foo ' , $ stdClass ],
144
- 'stdClass in nested stdClass ' => ['foo%5Bnested%5D%5Bbaz%5D=bar ' , 'foo ' , $ nestedStdClass ],
138
+ 'null ' => ['' , 'foo ' , null ],
139
+ 'string ' => ['?foo=bar ' , 'foo ' , 'bar ' ],
140
+ 'boolean-false ' => ['?foo=0 ' , 'foo ' , false ],
141
+ 'boolean-true ' => ['?foo=1 ' , 'foo ' , true ],
142
+ 'object implementing __toString() ' => ['?foo=bar ' , 'foo ' , new StringableObject ()],
143
+ 'object implementing __toString() in nested array ' => ['?foo%5Bbaz%5D=bar ' , 'foo ' , ['baz ' => new StringableObject ()]],
144
+ 'stdClass ' => ['foo%5Bbaz%5D=bar ' , '?foo ' , $ stdClass ],
145
+ 'stdClass in nested stdClass ' => ['?foo%5Bnested%5D%5Bbaz%5D=bar ' , 'foo ' , $ nestedStdClass ],
146
+ 'not stringable object ' => ['' , 'foo ' , new NotStringableObject ()],
145
147
];
146
148
}
147
149
148
- public function testUrlWithNullExtraParameters ()
149
- {
150
- $ routes = $ this ->getRoutes ('test ' , new Route ('/testing ' ));
151
- $ url = $ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => null ], UrlGeneratorInterface::ABSOLUTE_URL );
152
-
153
- $ this ->assertEquals ('http://localhost/app.php/testing ' , $ url );
154
- }
155
-
156
150
public function testUrlWithExtraParametersFromGlobals ()
157
151
{
158
152
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing ' ));
@@ -925,3 +919,7 @@ public function __toString()
925
919
return 'bar ' ;
926
920
}
927
921
}
922
+
923
+ class NotStringableObject
924
+ {
925
+ }
0 commit comments