Skip to content

Commit

Permalink
New test without $params.
Browse files Browse the repository at this point in the history
  • Loading branch information
andretefras committed Oct 23, 2016
1 parent f07504e commit 5d4757c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/TestCase/Routing/RouteBuilderTest.php
Expand Up @@ -306,7 +306,24 @@ public function testRedirect()
public function testPrefix()
{
$routes = new RouteBuilder($this->collection, '/path', ['key' => 'value']);
$res = $routes->prefix('admin', ['key' => 'value'], function ($r) {
$res = $routes->prefix('admin', ['param' => 'value'], function ($r) {
$this->assertInstanceOf('Cake\Routing\RouteBuilder', $r);
$this->assertCount(0, $this->collection->routes());
$this->assertEquals('/path/admin', $r->path());
$this->assertEquals(['prefix' => 'admin', 'key' => 'value', 'param' => 'value'], $r->params());
});
$this->assertNull($res);
}

/**
* Test creating sub-scopes with prefix()
*
* @return void
*/
public function testPrefixWithNoParams()
{
$routes = new RouteBuilder($this->collection, '/path', ['key' => 'value']);
$res = $routes->prefix('admin', function ($r) {
$this->assertInstanceOf('Cake\Routing\RouteBuilder', $r);
$this->assertCount(0, $this->collection->routes());
$this->assertEquals('/path/admin', $r->path());
Expand Down

0 comments on commit 5d4757c

Please sign in to comment.