removed application and resolver classes. added phpunit tests.
This commit is contained in:
51
tests/ArrTest.php
Normal file
51
tests/ArrTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class ArrTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider getArray
|
||||
*/
|
||||
public function testGetMethodReturnsItemsFromArray($array)
|
||||
{
|
||||
$this->assertEquals(Arr::get($array, 'email'), $array['email']);
|
||||
$this->assertEquals(Arr::get($array, 'names.uncle'), $array['names']['uncle']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getArray
|
||||
*/
|
||||
public function testGetMethodReturnsDefaultWhenItemDoesntExist($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 testSetMethodSetsItemsInArray($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');
|
||||
|
||||
}
|
||||
|
||||
public function getArray()
|
||||
{
|
||||
return array(array(
|
||||
array(
|
||||
'email' => 'taylorotwell@gmail.com',
|
||||
'names' => array(
|
||||
'uncle' => 'Mike',
|
||||
),
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
34
tests/bootstrap.php
Normal file
34
tests/bootstrap.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Laravel - A clean and classy framework for PHP web development.
|
||||
*
|
||||
* @package Laravel
|
||||
* @version 2.0.0
|
||||
* @author Taylor Otwell <taylorotwell@gmail.com>
|
||||
* @link http://laravel.com
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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';
|
||||
|
||||
require realpath($laravel).'/bootstrap.php';
|
||||
Reference in New Issue
Block a user