Import testing bundle to laravel/tests directory.
This commit is contained in:
10
laravel/tests/application/controllers/admin/panel.php
Normal file
10
laravel/tests/application/controllers/admin/panel.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Admin_Panel_Controller extends Controller {
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
return 'Admin_Panel_Index';
|
||||
}
|
||||
|
||||
}
|
||||
20
laravel/tests/application/controllers/auth.php
Normal file
20
laravel/tests/application/controllers/auth.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Auth_Controller extends Controller {
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_login()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_profile($name)
|
||||
{
|
||||
return $name;
|
||||
}
|
||||
|
||||
}
|
||||
65
laravel/tests/application/controllers/filter.php
Normal file
65
laravel/tests/application/controllers/filter.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class Filter_Controller extends Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
Filter::register('test-all-before', function() { $_SERVER['test-all-before'] = true; });
|
||||
Filter::register('test-all-after', function() { $_SERVER['test-all-after'] = true; });
|
||||
Filter::register('test-profile-before', function() { $_SERVER['test-profile-before'] = true; });
|
||||
Filter::register('test-except', function() { $_SERVER['test-except'] = true; });
|
||||
Filter::register('test-on-post', function() { $_SERVER['test-on-post'] = true; });
|
||||
Filter::register('test-on-get-put', function() { $_SERVER['test-on-get-put'] = true; });
|
||||
Filter::register('test-before-filter', function() { return 'Filtered!'; });
|
||||
Filter::register('test-param', function($var1, $var2) { return $var1.$var2; });
|
||||
Filter::register('test-multi-1', function() { $_SERVER['test-multi-1'] = true; });
|
||||
Filter::register('test-multi-2', function() { $_SERVER['test-multi-2'] = true; });
|
||||
|
||||
$this->filter('before', 'test-all-before');
|
||||
$this->filter('after', 'test-all-after');
|
||||
$this->filter('before', 'test-profile-before')->only(array('profile'));
|
||||
$this->filter('before', 'test-except')->except(array('index', 'profile'));
|
||||
$this->filter('before', 'test-on-post')->on(array('post'));
|
||||
$this->filter('before', 'test-on-get-put')->on(array('get', 'put'));
|
||||
$this->filter('before', 'test-before-filter')->only('login');
|
||||
$this->filter('after', 'test-before-filter')->only('logout');
|
||||
$this->filter('before', 'test-param:1,2')->only('edit');
|
||||
$this->filter('before', 'test-multi-1|test-multi-2')->only('save');
|
||||
}
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_profile()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_show()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_edit()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_save()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_login()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function action_logout()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
}
|
||||
42
laravel/tests/application/controllers/home.php
Normal file
42
laravel/tests/application/controllers/home.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class Home_Controller extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The Default Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Instead of using RESTful routes and anonymous functions, you might wish
|
||||
| to use controllers to organize your application API. You'll love them.
|
||||
|
|
||||
| To start using this controller simply remove the default route from the
|
||||
| application "routes.php" file. Laravel is smart enough to locate this
|
||||
| controller and call the default method, which is "action_index".
|
||||
|
|
||||
| This controller responds to URIs beginning with "home", and it also
|
||||
| serves as the default controller for the application, meaning it
|
||||
| handles requests to the root of the application.
|
||||
|
|
||||
| You can respond to GET requests to "/home/profile" like so:
|
||||
|
|
||||
| public function action_profile()
|
||||
| {
|
||||
| return "This is your profile!";
|
||||
| }
|
||||
|
|
||||
| Any extra segments are passed to the method as parameters:
|
||||
|
|
||||
| public function action_profile($id)
|
||||
| {
|
||||
| return "This is the profile for user {$id}.";
|
||||
| }
|
||||
|
|
||||
*/
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
return View::make('home.index');
|
||||
}
|
||||
|
||||
}
|
||||
17
laravel/tests/application/controllers/restful.php
Normal file
17
laravel/tests/application/controllers/restful.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class Restful_Controller extends Controller {
|
||||
|
||||
public $restful = true;
|
||||
|
||||
public function get_index()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
public function post_index()
|
||||
{
|
||||
return __FUNCTION__;
|
||||
}
|
||||
|
||||
}
|
||||
12
laravel/tests/application/controllers/template/basic.php
Normal file
12
laravel/tests/application/controllers/template/basic.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class Template_Basic_Controller extends Controller {
|
||||
|
||||
public $layout = 'home.index';
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
12
laravel/tests/application/controllers/template/named.php
Normal file
12
laravel/tests/application/controllers/template/named.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class Template_Named_Controller extends Controller {
|
||||
|
||||
public $layout = 'name: home';
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
26
laravel/tests/application/controllers/template/override.php
Normal file
26
laravel/tests/application/controllers/template/override.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class TemplateStub {
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return 'TemplateStub';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Template_Override_Controller extends Controller {
|
||||
|
||||
public $layout = 'home.index';
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function layout()
|
||||
{
|
||||
return 'Layout';
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user