Skip to content
This repository
Browse code

Adding tests for plugin shortcut route generation. Refs #535

  • Loading branch information...
commit ffb5c365787b804fe66d949b4d63a308af2e92ba 1 parent 3627f3b
Mark Story authored April 02, 2010

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  cake/tests/cases/libs/router.test.php
21  cake/tests/cases/libs/router.test.php
@@ -746,6 +746,27 @@ function testUrlGenerationPlugins() {
746 746
 	}
747 747
 
748 748
 /**
  749
+ * test that plugin short cut routes behave properly. Parse and reverse route correctly.
  750
+ *
  751
+ * @return void
  752
+ */
  753
+	function testPluginShortcutRoutes() {
  754
+		$result = Router::url(array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'index'));
  755
+		$this->assertEqual($result, '/test_plugin', 'Plugin shortcut index action failed.');
  756
+	
  757
+		$result = Router::url(array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'view', 1));
  758
+		$this->assertEqual($result, '/test_plugin/view/1', 'Plugin shortcut with passed args failed.');
  759
+
  760
+		$result = Router::url(array(
  761
+			'plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'view',
  762
+			1, 'sort' => 'title', 'dir' => 'asc'
  763
+		));
  764
+		$this->assertEqual(
  765
+			$result, '/test_plugin/view/1/sort:title/dir:asc', 'Plugin shortcut with passed + named args failed.'
  766
+		);
  767
+	}
  768
+
  769
+/**
749 770
  * test that you can leave active plugin routes with plugin = null
750 771
  *
751 772
  * @return void

0 notes on commit ffb5c36

Please sign in to comment.
Something went wrong with that request. Please try again.