@@ -330,25 +330,6 @@ public function testMapResourcesConnectOptions() {
330
330
$ this ->assertEquals ('^(bar)$ ' , $ route ->options ['foo ' ]);
331
331
}
332
332
333
- /**
334
- * Test that RouterCollection::all() gets the list of all connected routes.
335
- *
336
- * @return void
337
- */
338
- public function testRouteCollectionRoutes () {
339
- $ collection = new RouteCollection ();
340
- Router::setRouteCollection ($ collection );
341
- Router::mapResources ('Posts ' );
342
-
343
- $ routes = $ collection ->all ();
344
-
345
- $ this ->assertEquals (count ($ routes ), 6 );
346
- $ this ->assertInstanceOf ('Cake\Routing\Route\Route ' , $ routes [0 ]);
347
- $ this ->assertEquals ($ collection ->get (0 ), $ routes [0 ]);
348
- $ this ->assertInstanceOf ('Cake\Routing\Route\Route ' , $ routes [5 ]);
349
- $ this ->assertEquals ($ collection ->get (5 ), $ routes [5 ]);
350
- }
351
-
352
333
/**
353
334
* Test mapResources with a plugin and prefix.
354
335
*
@@ -2625,10 +2606,15 @@ public function testUrlWithRequestAction() {
2625
2606
public function testUrlFullUrlReturnFromRoute () {
2626
2607
$ url = 'http://example.com/posts/view/1 ' ;
2627
2608
2628
- $ routes = $ this ->getMock ('Cake\Routing\RouteCollection ' );
2629
- Router::setRouteCollection ($ routes );
2630
- $ routes ->expects ($ this ->any ())->method ('match ' )
2609
+ $ route = $ this ->getMock (
2610
+ 'Cake\Routing\Route\Route ' ,
2611
+ ['match ' ],
2612
+ ['/:controller/:action/* ' ]
2613
+ );
2614
+ $ route ->expects ($ this ->any ())
2615
+ ->method ('match ' )
2631
2616
->will ($ this ->returnValue ($ url ));
2617
+ Router::connect ($ route );
2632
2618
2633
2619
$ result = Router::url (array ('controller ' => 'posts ' , 'action ' => 'view ' , 1 ));
2634
2620
$ this ->assertEquals ($ url , $ result );
@@ -2731,69 +2717,6 @@ public function testResourceMap() {
2731
2717
Router::resourceMap ($ default );
2732
2718
}
2733
2719
2734
- /**
2735
- * Test setting the default route class
2736
- *
2737
- * @return void
2738
- */
2739
- public function testDefaultRouteClass () {
2740
- $ routes = $ this ->getMock ('Cake\Routing\RouteCollection ' );
2741
- $ this ->getMock ('Cake\Routing\Route\Route ' , [], array ('/test ' ), 'TestDefaultRouteClass ' );
2742
-
2743
- $ routes ->expects ($ this ->once ())
2744
- ->method ('add ' )
2745
- ->with ($ this ->isInstanceOf ('\TestDefaultRouteClass ' ));
2746
-
2747
- Router::setRouteCollection ($ routes );
2748
- Router::defaultRouteClass ('\TestDefaultRouteClass ' );
2749
-
2750
- Router::connect ('/ ' , array ('controller ' => 'pages ' , 'action ' => 'display ' , 'home ' ));
2751
- }
2752
-
2753
- /**
2754
- * Test getting the default route class
2755
- *
2756
- * @return void
2757
- */
2758
- public function testDefaultRouteClassGetter () {
2759
- $ routeClass = '\TestDefaultRouteClass ' ;
2760
- Router::defaultRouteClass ($ routeClass );
2761
-
2762
- $ this ->assertEquals ($ routeClass , Router::defaultRouteClass ());
2763
- $ this ->assertEquals ($ routeClass , Router::defaultRouteClass (null ));
2764
- }
2765
-
2766
- /**
2767
- * Test that route classes must extend Cake\Routing\Route\Route
2768
- *
2769
- * @expectedException \Cake\Error\Exception
2770
- * @return void
2771
- */
2772
- public function testDefaultRouteException () {
2773
- Router::defaultRouteClass ('' );
2774
- Router::connect ('/:controller ' , []);
2775
- }
2776
-
2777
- /**
2778
- * Test that route classes must extend Cake\Routing\Route\Route
2779
- *
2780
- * @expectedException \Cake\Error\Exception
2781
- * @return void
2782
- */
2783
- public function testSettingInvalidDefaultRouteException () {
2784
- Router::defaultRouteClass ('Object ' );
2785
- }
2786
-
2787
- /**
2788
- * Test that class must exist
2789
- *
2790
- * @expectedException \Cake\Error\Exception
2791
- * @return void
2792
- */
2793
- public function testSettingNonExistentDefaultRouteException () {
2794
- Router::defaultRouteClass ('NonExistentClass ' );
2795
- }
2796
-
2797
2720
/**
2798
2721
* Test that the compatibility method for incoming urls works.
2799
2722
*
0 commit comments