Commit 493e1c13 authored by Taylor Otwell's avatar Taylor Otwell

remove tests from main repository, moved storage directory to application.

parent 6081baaa
......@@ -12,9 +12,9 @@ define('BLADE_EXT', '.blade.php');
define('APP_PATH', realpath($application).'/');
define('BASE_PATH', realpath("$laravel/..").'/');
define('PUBLIC_PATH', realpath($public).'/');
define('STORAGE_PATH', realpath($storage).'/');
define('SYS_PATH', realpath($laravel).'/');
define('STORAGE_PATH', APP_PATH.'storage/');
define('CACHE_PATH', STORAGE_PATH.'cache/');
define('CONFIG_PATH', APP_PATH.'config/');
define('CONTROLLER_PATH', APP_PATH.'controllers/');
......@@ -42,7 +42,7 @@ if (isset($_SERVER['LARAVEL_ENV']))
define('ENV_CONFIG_PATH', $environment);
unset($application, $public, $storage, $laravel, $environment);
unset($application, $public, $laravel, $environment);
/**
* Require all of the classes that can't be loaded by the auto-loader.
......
......@@ -8,34 +8,22 @@
* @link http://laravel.com
*/
/*
|--------------------------------------------------------------------------
| Tick... Tock... Tick... Tock
|--------------------------------------------------------------------------
*/
define('START_TIME', microtime(true));
/*
|--------------------------------------------------------------------------
| Laravel Installation Paths
|--------------------------------------------------------------------------
*/
// --------------------------------------------------------------
// The path to the application directory.
// --------------------------------------------------------------
$application = '../application';
// --------------------------------------------------------------
// The path to the Laravel directory.
// --------------------------------------------------------------
$laravel = '../laravel';
$storage = '../storage';
// --------------------------------------------------------------
// The path to the public directory.
// --------------------------------------------------------------
$public = __DIR__;
/*
|--------------------------------------------------------------------------
| 3... 2... 1... Lift-off!
|--------------------------------------------------------------------------
*/
require $laravel.'/laravel.php';
echo number_format((microtime(true) - START_TIME) * 1000, 2);
\ No newline at end of file
// --------------------------------------------------------------
// Launch Laravel.
// --------------------------------------------------------------
require $laravel.'/laravel.php';
\ No newline at end of file
*
\ No newline at end of file
*
\ No newline at end of file
*
\ No newline at end of file
<?php use Laravel\Arr;
class ArrTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider getArray
*/
public function test_get_method_returns_item_from_array($array)
{
$this->assertEquals(Arr::get($array, 'email'), $array['email']);
$this->assertEquals(Arr::get($array, 'names.uncle'), $array['names']['uncle']);
}
/**
* @dataProvider getArray
*/
public function test_get_method_returns_default_when_item_doesnt_exist($array)
{
$this->assertNull(Arr::get($array, 'names.aunt'));
$this->assertEquals(Arr::get($array, 'names.aunt', 'Tammy'), 'Tammy');
$this->assertEquals(Arr::get($array, 'names.aunt', function() {return 'Tammy';}), 'Tammy');
}
/**
* @dataProvider getArray
*/
public function test_set_method_sets_items_in_array($array)
{
Arr::set($array, 'name', 'Taylor');
Arr::set($array, 'names.aunt', 'Tammy');
Arr::set($array, 'names.friends.best', 'Abigail');
$this->assertEquals($array['name'], 'Taylor');
$this->assertEquals($array['names']['aunt'], 'Tammy');
$this->assertEquals($array['names']['friends']['best'], 'Abigail');
}
/**
* @dataProvider getArray
*/
public function test_first_method_returns_first_item_passing_truth_test($array)
{
$array['email2'] = 'taylor@hotmail.com';
$this->assertEquals('taylorotwell@gmail.com', Arr::first($array, function($k, $v) {return substr($v, 0, 3) == 'tay';}));
}
/**
* @dataProvider getArray
*/
public function test_first_method_returns_default_when_no_matching_item_is_found($array)
{
$this->assertNull(Arr::first($array, function($k, $v) {return $v === 'something';}));
$this->assertEquals('default', Arr::first($array, function($k, $v) {return $v === 'something';}, 'default'));
$this->assertEquals('default', Arr::first($array, function($k, $v) {return $v === 'something';}, function() {return 'default';}));
}
public function getArray()
{
return array(array(
array(
'email' => 'taylorotwell@gmail.com',
'names' => array(
'uncle' => 'Mike',
),
)
));
}
}
\ No newline at end of file
<?php namespace Laravel; use PHPUnit_Framework_TestCase;
class ConfigTest extends PHPUnit_Framework_TestCase {
public function test_has_method_indicates_if_configuration_item_exists()
{
Config::set('hasvalue', true);
$this->assertTrue(Config::has('hasvalue'));
}
public function test_has_method_returns_false_when_item_doesnt_exist()
{
$this->assertFalse(Config::has('something'));
}
public function test_config_get_can_retrieve_item_from_configuration()
{
$this->assertTrue(is_array(Config::get('application')));
$this->assertEquals(Config::get('application.url'), 'http://localhost');
}
public function test_get_method_returns_default_when_requested_item_doesnt_exist()
{
$this->assertNull(Config::get('config.item'));
$this->assertEquals(Config::get('config.item', 'test'), 'test');
$this->assertEquals(Config::get('config.item', function() {return 'test';}), 'test');
}
public function test_config_set_can_set_configuration_items()
{
Config::set('application.names.test', 'test');
Config::set('application.url', 'test');
Config::set('session', array());
Config::set('test', array());
$this->assertEquals(Config::get('application.names.test'), 'test');
$this->assertEquals(Config::get('application.url'), 'test');
$this->assertEquals(Config::get('session'), array());
$this->assertEquals(Config::get('test'), array());
}
}
\ No newline at end of file
<?php use Laravel\Lang;
class LangTest extends PHPUnit_Framework_TestCase {
public function test_simple_language_lines_can_be_retrieved()
{
$language = require LANG_PATH.'en/validation.php';
$this->assertEquals($language['required'], Lang::line('validation.required')->get());
}
public function test_default_value_is_returned_when_line_doesnt_exist()
{
$language = require LANG_PATH.'en/validation.php';
$this->assertEquals('Taylor', Lang::line('validation.something')->get(null, 'Taylor'));
}
public function test_replacements_can_be_made_on_language_lines()
{
$language = require LANG_PATH.'en/validation.php';
$expect = str_replace(':attribute', 'E-Mail', $language['required']);
$this->assertEquals($expect, Lang::line('validation.required', array('attribute' => 'E-Mail'))->get());
}
}
\ No newline at end of file
<?php
class RequestTest extends PHPUnit_Framework_TestCase {
public function setUp()
{
$_POST = array();
$_SERVER = array();
Laravel\Request::$uri = null;
}
/**
* @dataProvider requestUriProvider
*/
public function test_correct_uri_is_returned_when_request_uri_is_used($uri, $expectation)
{
$_SERVER['REQUEST_URI'] = $uri;
$this->assertEquals($expectation, Laravel\Request::uri());
}
public function test_request_method_returns_spoofed_method_if_uri_is_spoofed()
{
$_POST = array(Laravel\Request::spoofer => 'something');
$this->assertEquals('something', Laravel\Request::method());
}
public function test_request_method_returns_request_method_from_server_array()
{
$_SERVER['REQUEST_METHOD'] = 'PUT';
$this->assertEquals('PUT', Laravel\Request::method());
}
public function test_server_method_returns_from_the_server_array()
{
$_SERVER = array('TEST' => 'something', 'USER' => array('NAME' => 'taylor'));
$this->assertEquals('something', Laravel\Request::server('test'));
$this->assertEquals('taylor', Laravel\Request::server('user.name'));
}
public function test_spoofed_returns_true_when_request_is_spoofed()
{
$_POST[Laravel\Request::spoofer] = 'something';
$this->assertTrue(Laravel\Request::spoofed());
}
public function test_spoofed_returns_false_when_request_isnt_spoofed()
{
$this->assertFalse(Laravel\Request::spoofed());
}
public function test_ip_method_returns_client_ip_address()
{
$_SERVER['REMOTE_ADDR'] = 'something';
$this->assertEquals('something', Laravel\Request::ip());
$_SERVER['HTTP_CLIENT_IP'] = 'something';
$this->assertEquals('something', Laravel\Request::ip());
$_SERVER['HTTP_X_FORWARDED_FOR'] = 'something';
$this->assertEquals('something', Laravel\Request::ip());
$_SERVER = array();
$this->assertEquals('0.0.0.0', Laravel\Request::ip());
}
public function test_protocol_returns_server_protocol()
{
$_SERVER['SERVER_PROTOCOL'] = 'taylor';
$this->assertEquals('taylor', Laravel\Request::protocol());
unset($_SERVER['SERVER_PROTOCOL']);
$this->assertEquals('HTTP/1.1', Laravel\Request::protocol());
}
public function test_ajax_method_returns_false_when_not_ajax()
{
$this->assertFalse(Laravel\Request::ajax());
}
public function test_ajax_method_returns_true_when_ajax()
{
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest';
$this->assertTrue(Laravel\Request::ajax());
}
public function requestUriProvider()
{
return array(
array('/index.php', '/'),
array('/index.php/', '/'),
array('http://localhost/user', 'user'),
array('http://localhost/user/', 'user'),
array('http://localhost/index.php', '/'),
array('http://localhost/index.php/', '/'),
array('http://localhost/index.php//', '/'),
array('http://localhost/index.php/user', 'user'),
array('http://localhost/index.php/user/', 'user'),
array('http://localhost/index.php/user/profile', 'user/profile'),
);
}
}
\ No newline at end of file
<?php use Laravel\Routing\Filter;
class RouteFilterTest extends PHPUnit_Framework_TestCase {
public function test_simple_filters_can_be_called()
{
$filters = array(
'simple' => function()
{
return 'simple';
},
'parameters' => function($one, $two, $three = null)
{
return $one.'|'.$two.'|'.$three;
},
);
Filter::register($filters);
$this->assertEquals(Filter::run(array('simple'), array(), true), 'simple');
$this->assertEquals(Filter::run(array('parameters:1,2'), array(), true), '1|2|');
$this->assertEquals(Filter::run(array('parameters:1,2'), array(3), true), '3|1|2');
}
public function test_after_filters_are_called()
{
$filters = array(
'after1' => function()
{
define('ROUTE_FILTER_AFTER_1', 1);
},
'after2' => function()
{
define('ROUTE_FILTER_AFTER_2', 2);
},
);
Filter::register($filters);
Filter::run(array('after1', 'after2'));
$this->assertTrue(defined('ROUTE_FILTER_AFTER_1'));
$this->assertTrue(defined('ROUTE_FILTER_AFTER_2'));
}
}
\ No newline at end of file
<?php use Laravel\Routing\Loader;
class RouteLoaderTest extends PHPUnit_Framework_TestCase {
public function test_loader_can_load_base_routes()
{
$loader = $this->getLoader();
$routes = $loader->load('/');
$this->assertEquals(count($routes), 2);
$this->assertTrue(array_key_exists('GET /', $routes));
$this->assertTrue(array_key_exists('GET /root', $routes));
}
public function test_loader_can_load_single_nested_routes()
{
$loader = $this->getLoader();
$routes = $loader->load('user');
$this->assertEquals(count($routes), 4);
$this->assertTrue(array_key_exists('GET /user', $routes));
$this->assertTrue(array_key_exists('GET /user/profile', $routes));
}
public function test_loader_can_load_multi_nested_routes()
{
$loader = $this->getLoader();
$routes = $loader->load('admin/panel');
$this->assertEquals(count($routes), 4);
$this->assertTrue(array_key_exists('GET /admin/panel/show', $routes));
$this->assertTrue(array_key_exists('GET /admin/panel/update', $routes));
}
public function test_everything_loads_all_routes()
{
$loader = $this->getLoader();
$routes = $loader->everything();
$this->assertEquals(count($routes), 6);
}
private function getLoader()
{
return new Loader(FIXTURE_PATH.'RouteLoader/', FIXTURE_PATH.'RouteLoader/routes/');
}
}
<?php
use Laravel\IoC;
use Laravel\Config;
use Laravel\Session\Manager;
class SessionManagerTest extends PHPUnit_Framework_TestCase {
public function setUp()
{
Manager::$session = array();
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_calls_transporter_get($driver, $transporter)
{
$transporter->expects($this->once())->method('get');
Manager::start($driver, $transporter);
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_calls_driver_load_with_session_id($driver, $transporter)
{
$transporter->expects($this->any())
->method('get')
->will($this->returnValue('something'));
$driver->expects($this->once())
->method('load')
->with($this->equalTo('something'));
Manager::start($driver, $transporter);
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_returns_payload_when_found($driver, $transporter)
{
$this->setDriverExpectation($driver, 'load', $this->getDummySession());
Manager::start($driver, $transporter);
$this->assertEquals(Manager::$session, $this->getDummySession());
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_creates_new_session_when_session_is_null($driver, $transporter)
{
$this->setDriverExpectation($driver, 'load', null);
Manager::start($driver, $transporter);
$this->assertTrue(is_array(Manager::$session['data']));
$this->assertEquals(strlen(Manager::$session['id']), 40);
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_creates_new_session_when_session_is_expired($driver, $transporter)
{
$dateTime = new DateTime('1970-01-01');
$this->setDriverExpectation($driver, 'load', array('last_activity' => $dateTime->getTimestamp()));
Manager::start($driver, $transporter);
$this->assertEquals(strlen(Manager::$session['id']), 40);
}
/**
* @dataProvider mockProvider
*/
public function test_session_manager_sets_csrf_token_if_one_is_not_present($driver, $transporter)
{
$session = $this->getDummySession();
unset($session['data']['csrf_token']);
$this->setDriverExpectation($driver, 'load', $session);
Manager::start($driver, $transporter);
$this->assertTrue(isset(Manager::$session['data']['csrf_token']));
$this->assertEquals(strlen(Manager::$session['data']['csrf_token']), 16);
}
/**
* @dataProvider mockProvider
*/
public function test_close_method_calls_driver_and_transporter($driver, $transporter)
{
$driver->expects($this->any())
->method('load')
->will($this->returnValue($this->getDummySession()));
Manager::start($driver, $transporter);
$driver->expects($this->once())
->method('save');
$transporter->expects($this->once())
->method('put');
Manager::close($driver, $transporter);
}
/**
* @dataProvider mockProvider
*/
public function test_close_method_calls_sweep_when_driver_is_sweeper($driver, $transporter)
{
$driver = $this->getMock('SweeperStub', array('sweep'));
$driver->expects($this->once())->method('sweep');
Manager::start($driver, $transporter);
Config::$items['session']['sweepage'] = array(100, 100);
Manager::close($driver, $transporter);
}
/**
* @dataProvider mockProvider
*/
public function test_close_method_doesnt_call_sweep_when_driver_isnt_sweeper($driver, $transporter)
{
$driver = $this->getMock('Laravel\\Session\\Drivers\\Driver', array('sweep', 'load', 'save', 'delete'));
$driver->expects($this->never())->method('sweep');
Manager::start($driver, $transporter);
Config::$items['session']['sweepage'] = array(100, 100);
Manager::close($driver, $transporter);
}
public function test_has_method_indicates_if_item_exists_in_payload()
{
Manager::$session = $this->getDummyData();
$this->assertTrue(Manager::has('name'));
$this->assertTrue(Manager::has('age'));
$this->assertTrue(Manager::has('gender'));
$this->assertFalse(Manager::has('something'));
$this->assertFalse(Manager::has('id'));
$this->assertFalse(Manager::has('last_activity'));
}
public function test_get_method_returns_item_from_payload()
{
Manager::$session = $this->getDummyData();
$this->assertEquals(Manager::get('name'), 'Taylor');
$this->assertEquals(Manager::get('age'), 25);
$this->assertEquals(Manager::get('gender'), 'male');
}
public function test_get_method_returns_default_when_item_doesnt_exist()
{
Manager::$session = $this->getDummyData();
$this->assertNull(Manager::get('something'));
$this->assertEquals('Taylor', Manager::get('something', 'Taylor'));
$this->assertEquals('Taylor', Manager::get('something', function() {return 'Taylor';}));
}
public function test_put_method_adds_to_payload()
{
Manager::$session = $this->getDummyData();
Manager::put('name', 'Weldon');
Manager::put('workmate', 'Joe');
$this->assertEquals(Manager::$session['data']['name'], 'Weldon');
$this->assertEquals(Manager::$session['data']['workmate'], 'Joe');
}
public function test_flash_method_puts_item_in_flash_data()
{
Manager::$session = array();
Manager::flash('name', 'Taylor');
$this->assertEquals(Manager::$session['data'][':new:name'], 'Taylor');
}
public function test_reflash_keeps_all_session_data()
{
Manager::$session = array('data' => array(':old:name' => 'Taylor', ':old:age' => 25));
Manager::reflash();
$this->assertTrue(isset(Manager::$session['data'][':new:name']));
$this->assertTrue(isset(Manager::$session['data'][':new:age']));
$this->assertFalse(isset(Manager::$session['data'][':old:name']));
$this->assertFalse(isset(Manager::$session['data'][':old:age']));
}
public function test_keep_method_keeps_specified_session_data()
{
Manager::$session = array('data' => array(':old:name' => 'Taylor', ':old:age' => 25));
Manager::keep('name');
$this->assertTrue(isset(Manager::$session['data'][':new:name']));
$this->assertFalse(isset(Manager::$session['data'][':old:name']));
Manager::$session = array('data' => array(':old:name' => 'Taylor', ':old:age' => 25));
Manager::keep(array('name', 'age'));
$this->assertTrue(isset(Manager::$session['data'][':new:name']));
$this->assertTrue(isset(Manager::$session['data'][':new:age']));
$this->assertFalse(isset(Manager::$session['data'][':old:name']));
$this->assertFalse(isset(Manager::$session['data'][':old:age']));
}
public function test_flush_method_clears_payload_data()
{
Manager::$session = array('data' => array('name' => 'Taylor'));
Manager::flush();
$this->assertEquals(count(Manager::$session['data']), 0);
}
public function test_regenerate_session_sets_new_session_id()
{
Manager::$session = array('id' => 'something');
Manager::regenerate();
$this->assertTrue(Manager::$regenerated);
$this->assertEquals(strlen(Manager::$session['id']), 40);
}
public function test_age_method_sets_last_activity_time()
{
$data = $this->getDummyData();
unset($data['last_activity']);
Manager::$session = $data;
Manager::age();
$this->assertTrue(isset(Manager::$session['last_activity']));
}
public function test_age_method_ages_all_flash_data()
{
Manager::$session = $this->getDummyData();
Manager::age();
$this->assertTrue(isset(Manager::$session['data'][':old:age']));
$this->assertFalse(isset(Manager::$session['data'][':old:gender']));
}
public function test_age_method_returns_session_array()
{
Manager::$session = $this->getDummyData();
$age = Manager::age();
$this->assertEquals($age['id'], 'something');
}
// ---------------------------------------------------------------------
// Support Functions
// ---------------------------------------------------------------------
public function getDummyData()
{
return array('id' => 'something', 'last_activity' => time(), 'data' => array(
'name' => 'Taylor',
':new:age' => 25,
':old:gender' => 'male',
'state' => 'Oregon',
));
}
// ---------------------------------------------------------------------
// Providers
// ---------------------------------------------------------------------
public function mockProvider()
{
return array(array($this->getMockDriver(), $this->getMockTransporter()));
}
// ---------------------------------------------------------------------
// Support Functions
// ---------------------------------------------------------------------
private function setDriverExpectation($mock, $method, $session)
{
$mock->expects($this->any())
->method($method)
->will($this->returnValue($session));
}
private function getMockDriver()
{
return $this->getMock('Laravel\\Session\\Drivers\\Driver');
}
private function getMockTransporter()
{
return $this->getMock('Laravel\\Session\\Transporters\\Transporter', array('get', 'put'));
}
private function getDummySession()
{
return array(
'id' => 'something',
'last_activity' => time(),
'data' => array(
'name' => 'Taylor',
'csrf_token' => 'token'
));
}
private function getConfig()
{
return Config::$items['session'];
}
}
// ---------------------------------------------------------------------
// Stubs
// ---------------------------------------------------------------------
class SweeperStub implements Laravel\Session\Drivers\Driver, Laravel\Session\Drivers\Sweeper {
public function load($id) {}
public function save($session, $config, $exists) {}
public function delete($id) {}
public function sweep($expiration) {}
}
\ No newline at end of file
<?php
class StrTest extends PHPUnit_Framework_TestCase {
public function test_lower()
{
$this->assertEquals('something', Laravel\Str::lower('SomeThing'));
$this->assertEquals('τάχιστη', Laravel\Str::lower('ΤΆΧΙΣΤΗ'));
}
public function test_upper()
{
$this->assertEquals('SPEAK LOUDER', Laravel\Str::upper('speak louder'));
$this->assertEquals('ΤΆΧΙΣΤΗ', Laravel\Str::upper('Τάχιστη'));
}
public function test_title()
{
$this->assertEquals('This Is A Test', Laravel\Str::title('this is a test'));
$this->assertEquals('Τάχιστη Τάχιστη', Laravel\Str::title('τάχιστη τάχιστη'));
}
public function test_length()
{
$this->assertEquals(4, Laravel\Str::length('four'));
$this->assertEquals(7, Laravel\Str::length('τάχιστη'));
}
public function test_ascii()
{
$this->assertEquals('Deuxieme Article', Laravel\Str::ascii('Deuxième Article'));
}
public function test_random()
{
$this->assertEquals(5, strlen(Laravel\Str::random(5)));
}
public function test_limit()
{
$this->assertEquals('Thi...', Laravel\Str::limit('This is a string of text', 3, '...'));
$this->assertEquals('This is&nbsp;', Laravel\Str::limit('This is a string of text', 7, '&nbsp;'));
$this->assertEquals('τάχ', Laravel\Str::limit('τάχιστη', 3, ''));
}
public function test_limit_words()
{
$this->assertEquals('This is a...', Laravel\Str::words('This is a string of text', 3, '...'));
$this->assertEquals('This is a string&nbsp;', Laravel\Str::words('This is a string of text', 4, '&nbsp;'));
}
}
\ No newline at end of file
<?php use Laravel\URL, Laravel\Config;
class UrlTest extends PHPUnit_Framework_TestCase {
public function test_simple_url()
{
$this->assertEquals(URL::to(''), 'http://localhost/index.php/');
$this->assertEquals(URL::to('something'), 'http://localhost/index.php/something');
}
public function test_simple_url_without_index()
{
Config::set('application.index', '');
$this->assertEquals(Url::to(''), 'http://localhost/');
$this->assertEquals(Url::to('something'), 'http://localhost/something');
Config::set('application.index', 'index.php');
}
public function test_asset_url()
{
$this->assertEquals(URL::to_asset('img/test.jpg'), 'http://localhost/img/test.jpg');
Config::set('application.index', '');
$this->assertEquals(URL::to_asset('img/test.jpg'), 'http://localhost/img/test.jpg');
Config::set('application.index', 'index.php');
}
public function test_secure_url()
{
$this->assertEquals(URL::to_secure('something'), 'https://localhost/index.php/something');
Config::set('application.ssl', false);
$this->assertEquals(URL::to_secure('something'), 'http://localhost/index.php/something');
Config::set('application.ssl', true);
}
public function test_slug()
{
$this->assertEquals(URL::slug('My favorite blog!!'), 'my-favorite-blog');
$this->assertEquals(URL::slug('My favorite blog!!', '_'), 'my_favorite_blog');
}
}
\ No newline at end of file
<?php
use Laravel\Lang;
use Laravel\Validation\Validator;
class ValidatorTest extends PHPUnit_Framework_TestCase {
public function test_simple_group_of_validations()
{
$rules = array(
'email' => 'required|email',
'password' => 'required|confirmed|min:6',
'name' => 'required|alpha',
'age' => 'required',
);
$attributes = array(
'email' => 'taylorotwell',
'password' => 'something',
'password_confirmation' => 'something',
'name' => 'taylor5',
);
$messages = array('name_alpha' => 'The name must be alphabetic!');
$validator = Validator::make($attributes, $rules, $messages);
$this->assertFalse($validator->valid());
$this->assertTrue($validator->errors->has('name'));
$this->assertTrue($validator->errors->has('email'));
$this->assertFalse($validator->errors->has('password'));
$this->assertEquals(count($validator->errors->get('name')), 1);
$this->assertEquals($validator->errors->first('name'), 'The name must be alphabetic!');
$this->assertEquals($validator->errors->first('email'), Lang::line('validation.email', array('attribute' => 'email'))->get());
$this->assertEquals($validator->errors->first('age'), Lang::line('validation.required', array('attribute' => 'age'))->get());
}
}
\ No newline at end of file
<?php
return array(
'GET /' => function()
{
return 'GET /';
},
'GET /root' => function()
{
return 'GET /root';
},
);
\ No newline at end of file
<?php
return array(
'GET /admin/panel/show' => function()
{
return 'GET /admin/panel/show';
},
'GET /admin/panel/update' => function()
{
return 'GET /admin/panel/update';
},
);
\ No newline at end of file
<?php
return array(
'GET /user' => function()
{
return 'GET /user';
},
'GET /user/profile' => function()
{
return 'GET /user/profile';
},
);
\ No newline at end of file
<?php
/*
|--------------------------------------------------------------------------
| Installation Paths
|--------------------------------------------------------------------------
|
| Here you may specify the location of the various Laravel framework
| directories for your installation.
|
| Of course, these are already set to the proper default values, so you do
| not need to change them if you have not modified the directory structure.
|
*/
$application = '../application';
$laravel = '../laravel';
$packages = '../packages';
$storage = '../storage';
$public = '../public';
/*
|--------------------------------------------------------------------------
| Test Path Constants
|--------------------------------------------------------------------------
*/
define('FIXTURE_PATH', realpath('Fixtures').'/');
/*
|--------------------------------------------------------------------------
| Bootstrap The Laravel Core
|--------------------------------------------------------------------------
*/
require realpath($laravel).'/bootstrap/core.php';
\ No newline at end of file
<phpunit colors="true" bootstrap="bootstrap.php">
<testsuites>
<testsuite name="Laravel Framework Tests">
<directory>Cases</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment