Browse Source

Add tests for #7554

Route generation with extensions and query parameters works just fine.
Mark Story 10 years ago
parent
commit
21607e01d1
2 changed files with 20 additions and 0 deletions
  1. 10 0
      tests/TestCase/Routing/Route/RouteTest.php
  2. 10 0
      tests/TestCase/Routing/RouterTest.php

+ 10 - 0
tests/TestCase/Routing/Route/RouteTest.php

@@ -590,6 +590,16 @@ class RouteTest extends TestCase
             '_ext' => 'json',
         ]);
         $this->assertEquals('/posts/view/1.json', $result);
+
+        $result = $route->match([
+            'controller' => 'posts',
+            'action' => 'view',
+            1,
+            '_ext' => 'json',
+            'id' => 'b',
+            'c' => 'd'
+        ]);
+        $this->assertEquals('/posts/view/1.json?id=b&c=d', $result);
     }
 
     /**

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

@@ -1090,6 +1090,16 @@ class RouterTest extends TestCase
         ]);
         $expected = '/articles.json';
         $this->assertEquals($expected, $result);
+
+        $result = Router::url([
+            'plugin' => null,
+            'controller' => 'articles',
+            'action' => 'index',
+            'id' => 'testing',
+            '_ext' => 'json'
+        ]);
+        $expected = '/articles.json?id=testing';
+        $this->assertEquals($expected, $result);
     }
 
     /**