Browse Source

Add test for URL generation with multiple prefxies.

Mark Story 11 years ago
parent
commit
7a859105bb
1 changed files with 20 additions and 1 deletions
  1. 20 1
      tests/TestCase/Routing/RouterTest.php

+ 20 - 1
tests/TestCase/Routing/RouterTest.php

@@ -804,7 +804,6 @@ class RouterTest extends TestCase {
  * @return void
  */
 	public function testUrlGenerationWithPrefix() {
-		Configure::write('Routing.prefixes', array('admin'));
 		Router::reload();
 
 		Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
@@ -997,6 +996,26 @@ class RouterTest extends TestCase {
 	}
 
 /**
+ * Test URL generation with multiple prefixes.
+ *
+ * @return void
+ */
+	public function testUrlGenerationMultiplePrefixes() {
+		Router::prefix('admin', function ($routes) {
+			$routes->prefix('backoffice', function ($routes) {
+				$routes->fallbacks();
+			});
+		});
+		$result = Router::url([
+			'prefix' => 'admin/backoffice',
+			'controller' => 'Dashboards',
+			'action' => 'home'
+		]);
+		$expected = '/admin/backoffice/dashboards/home';
+		$this->assertEquals($expected, $result);
+	}
+
+/**
  * testUrlGenerationWithExtensions method
  *
  * @return void