@@ -70,8 +70,8 @@ public function testIteratorWithOverriddenRoutes()
70
70
$ collection ->add ('foo ' , new Route ('/foo ' ));
71
71
72
72
$ collection1 = new RouteCollection ();
73
- $ collection ->addCollection ($ collection1 );
74
73
$ collection1 ->add ('foo ' , new Route ('/foo1 ' ));
74
+ $ collection ->addCollection ($ collection1 );
75
75
76
76
$ this ->assertEquals ('/foo1 ' , $ this ->getFirstNamedRoute ($ collection , 'foo ' )->getPattern ());
77
77
}
@@ -82,8 +82,8 @@ public function testCount()
82
82
$ collection ->add ('foo ' , new Route ('/foo ' ));
83
83
84
84
$ collection1 = new RouteCollection ();
85
- $ collection ->addCollection ($ collection1 );
86
85
$ collection1 ->add ('foo1 ' , new Route ('/foo1 ' ));
86
+ $ collection ->addCollection ($ collection1 );
87
87
88
88
$ this ->assertCount (2 , $ collection );
89
89
}
@@ -212,19 +212,12 @@ public function testUniqueRouteWithGivenName()
212
212
$ collection3 = new RouteCollection ();
213
213
$ collection3 ->add ('foo ' , $ new = new Route ('/new ' ));
214
214
215
- $ collection1 ->addCollection ($ collection2 );
216
215
$ collection2 ->addCollection ($ collection3 );
217
-
218
- $ collection1 ->add ('stay ' , new Route ('/stay ' ));
219
-
220
- $ iterator = $ collection1 ->getIterator ();
216
+ $ collection1 ->addCollection ($ collection2 );
221
217
222
218
$ this ->assertSame ($ new , $ collection1 ->get ('foo ' ), '->get() returns new route that overrode previous one ' );
223
- // size of 2 because collection1 contains collection2 and /stay but not /old anymore
224
- $ this ->assertCount (2 , $ iterator , '->addCollection() removes previous routes when adding new routes with the same name ' );
225
- $ this ->assertInstanceOf ('Symfony\Component\Routing\RouteCollection ' , $ iterator ->current (), '->getIterator returns both Routes and RouteCollections ' );
226
- $ iterator ->next ();
227
- $ this ->assertInstanceOf ('Symfony\Component\Routing\Route ' , $ iterator ->current (), '->getIterator returns both Routes and RouteCollections ' );
219
+ // size of 1 because collection1 contains /new but not /old anymore
220
+ $ this ->assertCount (1 , $ collection1 ->getIterator (), '->addCollection() removes previous routes when adding new routes with the same name ' );
228
221
}
229
222
230
223
public function testGet ()
@@ -241,63 +234,6 @@ public function testGet()
241
234
$ this ->assertNull ($ collection1 ->get (0 ), '->get() does not disclose internal child RouteCollection ' );
242
235
}
243
236
244
- /**
245
- * @expectedException \InvalidArgumentException
246
- */
247
- public function testCannotSelfJoinCollection ()
248
- {
249
- $ collection = new RouteCollection ();
250
-
251
- $ collection ->addCollection ($ collection );
252
- }
253
-
254
- /**
255
- * @expectedException \InvalidArgumentException
256
- */
257
- public function testCannotAddExistingCollectionToTree ()
258
- {
259
- $ collection1 = new RouteCollection ();
260
- $ collection2 = new RouteCollection ();
261
- $ collection3 = new RouteCollection ();
262
-
263
- $ collection1 ->addCollection ($ collection2 );
264
- $ collection1 ->addCollection ($ collection3 );
265
- $ collection2 ->addCollection ($ collection3 );
266
- }
267
-
268
- public function testPatternDoesNotChangeWhenDefinitionOrderChanges ()
269
- {
270
- $ collection1 = new RouteCollection ();
271
- $ collection1 ->add ('a ' , new Route ('/a... ' ));
272
- $ collection2 = new RouteCollection ();
273
- $ collection2 ->add ('b ' , new Route ('/b... ' ));
274
- $ collection3 = new RouteCollection ();
275
- $ collection3 ->add ('c ' , new Route ('/c... ' ));
276
-
277
- $ rootCollection_A = new RouteCollection ();
278
- $ collection2 ->addCollection ($ collection3 , '/c ' );
279
- $ collection1 ->addCollection ($ collection2 , '/b ' );
280
- $ rootCollection_A ->addCollection ($ collection1 , '/a ' );
281
-
282
- // above should mean the same as below
283
-
284
- $ collection1 = new RouteCollection ();
285
- $ collection1 ->add ('a ' , new Route ('/a... ' ));
286
- $ collection2 = new RouteCollection ();
287
- $ collection2 ->add ('b ' , new Route ('/b... ' ));
288
- $ collection3 = new RouteCollection ();
289
- $ collection3 ->add ('c ' , new Route ('/c... ' ));
290
-
291
- $ rootCollection_B = new RouteCollection ();
292
- $ collection1 ->addCollection ($ collection2 , '/b ' );
293
- $ collection2 ->addCollection ($ collection3 , '/c ' );
294
- $ rootCollection_B ->addCollection ($ collection1 , '/a ' );
295
-
296
- // test it now
297
-
298
- $ this ->assertEquals ($ rootCollection_A , $ rootCollection_B );
299
- }
300
-
301
237
public function testSetHostnamePattern ()
302
238
{
303
239
$ collection = new RouteCollection ();
0 commit comments