Browse Source

added controller routing tests.

Taylor Otwell 13 years ago
parent
commit
2c593bdc15

+ 16 - 0
tests/cases/laravel/routing.test.php

@@ -68,4 +68,20 @@ class RoutingTest extends PHPUnit_Framework_TestCase {
 		$this->assertEquals('GET /profile/(:any)/(:any?)', Router::route('GET', 'profile/taylor/otwell')->key);
 	}
 
+	/**
+	 * Test that basic controller routing is working.
+	 *
+	 * @group laravel
+	 */
+	public function testBasicRouteToControllerIsRouted()
+	{
+		$this->assertEquals('home@index', Router::route('GET', '/')->action['uses']);
+		$this->assertEquals('auth@index', Router::route('GET', 'auth')->action['uses']);
+		$this->assertEquals('home@index', Router::route('GET', 'home')->action['uses']);
+		$this->assertEquals('home@index', Router::route('GET', 'home/index')->action['uses']);
+		$this->assertEquals('home@profile', Router::route('GET', 'home/profile')->action['uses']);
+		$this->assertEquals('admin.panel@index', Router::route('GET', 'admin/panel')->action['uses']);
+		$this->assertEquals('admin.panel@show', Router::route('GET', 'admin/panel/show')->action['uses']);
+	}
+
 }

+ 7 - 0
tests/laravel/application/controllers/admin/panel.php

@@ -0,0 +1,7 @@
+<?php
+
+class Admin_Panel_Controller extends Controller {
+
+
+
+}

+ 7 - 0
tests/laravel/application/controllers/auth.php

@@ -0,0 +1,7 @@
+<?php
+
+class User_Controller extends Controller {
+
+
+
+}