Browse Source

Test that RouterCollection::routes() gets the list of connected routes.

Ber Clausen 12 years ago
parent
commit
60cca760ce
1 changed files with 19 additions and 0 deletions
  1. 19 0
      tests/TestCase/Routing/RouterTest.php

+ 19 - 0
tests/TestCase/Routing/RouterTest.php

@@ -333,6 +333,25 @@ class RouterTest extends TestCase {
 	}
 
 /**
+ * Test that RouterCollection::routes() gets the list of connected routes.
+ *
+ * @return void
+ */
+	public function testRouteCollectionRoutes() {
+		$collection = new RouteCollection();
+		Router::setRouteCollection($collection);
+		Router::mapResources('Posts');
+
+		$routes = $collection->routes();
+
+		$this->assertEquals(count($routes), 6);
+		$this->assertInstanceOf('Cake\Routing\Route\Route', $routes[0]);
+		$this->assertEquals($collection->get(0), $routes[0]);
+		$this->assertInstanceOf('Cake\Routing\Route\Route', $routes[5]);
+		$this->assertEquals($collection->get(5), $routes[5]);
+	}
+
+/**
  * Test mapResources with a plugin and prefix.
  *
  * @return void