Skip to content
Permalink
Browse files

Add test for parse().

  • Loading branch information...
markstory committed Jun 24, 2014
1 parent 3a59514 commit 66314da73b9918a9700128587f57704db2e9e397
Showing with 36 additions and 0 deletions.
  1. +36 −0 tests/TestCase/Routing/ScopedRouteCollectionTest.php
@@ -225,4 +225,40 @@ public function testNestedPluginPathOption() {
});
}
/**
* Test parsing routes.
*
* @return void
*/
public function testParse() {
$routes = new ScopedRouteCollection('/b', ['key' => 'value']);
$routes->connect('/', ['controller' => 'Articles']);
$routes->connect('/:id', ['controller' => 'Articles', 'action' => 'view']);
$result = $routes->parse('/');
$this->assertEquals([], $result, 'Should not match, missing /b');
$result = $routes->parse('/b/');
$expected = [
'controller' => 'Articles',
'action' => 'index',
'pass' => [],
'plugin' => null,
'key' => 'value',
];
$this->assertEquals($expected, $result);
$result = $routes->parse('/b/the-thing?one=two');
$expected = [
'controller' => 'Articles',
'action' => 'view',
'id' => 'the-thing',
'pass' => [],
'plugin' => null,
'key' => 'value',
'?' => ['one' => 'two'],
];
$this->assertEquals($expected, $result);
}
}

0 comments on commit 66314da

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