Browse Source

New test without $params.

André Teixeira 9 years ago
parent
commit
5d4757ce8d
1 changed files with 18 additions and 1 deletions
  1. 18 1
      tests/TestCase/Routing/RouteBuilderTest.php

+ 18 - 1
tests/TestCase/Routing/RouteBuilderTest.php

@@ -306,7 +306,24 @@ class RouteBuilderTest extends TestCase
     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());