Skip to content
Permalink
Browse files

Fix docs and add missing test coverage.

  • Loading branch information...
markstory committed Jul 7, 2014
1 parent 72ee388 commit 7cb51d7d777ef072bbb953c6e205e9d4cf62e9b6
Showing with 15 additions and 9 deletions.
  1. +4 −1 src/Routing/RouteCollection.php
  2. +11 −8 tests/TestCase/Routing/RouteCollectionTest.php
@@ -55,8 +55,11 @@ class RouteCollection {
/**
* Add a route to the collection.
*
* @param \Cake\Routing\Route\Route $route The route object to add.
* @param array $options Addtional options for the route. Primarily for the
* `_name` option, which enables named routes.
*/
public function add(Route $route, $options) {
public function add(Route $route, $options = []) {
$this->_routes[] = $route;
// Explicit names
@@ -195,17 +195,20 @@ public function testNamed() {
}
/**
* Test adding with an error
*/
public function testAdd() {
}
/**
* Test the routes() method.
* Test the add() and routes() method.
*
* @return void
*/
public function testRoutes() {
public function testAddingRoutes() {
$one = new Route('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
$two = new Route('/', ['controller' => 'Dashboards', 'action' => 'display']);
$this->collection->add($one);
$this->collection->add($two);
$routes = $this->collection->routes();
$this->assertCount(2, $routes);
$this->assertSame($one, $routes[0]);
$this->assertSame($two, $routes[1]);
}
}

0 comments on commit 7cb51d7

Please sign in to comment.
You can’t perform that action at this time.