Commit bb77189f authored by Taylor Otwell's avatar Taylor Otwell

cleaned up arr tests.

parent b3c9dc59
...@@ -5,7 +5,7 @@ class ArrTest extends PHPUnit_Framework_TestCase { ...@@ -5,7 +5,7 @@ class ArrTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider getArray * @dataProvider getArray
*/ */
public function testGetMethodReturnsItemsFromArray($array) public function test_get_method_returns_item_from_array($array)
{ {
$this->assertEquals(Arr::get($array, 'email'), $array['email']); $this->assertEquals(Arr::get($array, 'email'), $array['email']);
$this->assertEquals(Arr::get($array, 'names.uncle'), $array['names']['uncle']); $this->assertEquals(Arr::get($array, 'names.uncle'), $array['names']['uncle']);
...@@ -14,7 +14,7 @@ class ArrTest extends PHPUnit_Framework_TestCase { ...@@ -14,7 +14,7 @@ class ArrTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider getArray * @dataProvider getArray
*/ */
public function testGetMethodReturnsDefaultWhenItemDoesntExist($array) public function test_get_method_returns_default_when_item_doesnt_exist($array)
{ {
$this->assertNull(Arr::get($array, 'names.aunt')); $this->assertNull(Arr::get($array, 'names.aunt'));
$this->assertEquals(Arr::get($array, 'names.aunt', 'Tammy'), 'Tammy'); $this->assertEquals(Arr::get($array, 'names.aunt', 'Tammy'), 'Tammy');
...@@ -24,7 +24,7 @@ class ArrTest extends PHPUnit_Framework_TestCase { ...@@ -24,7 +24,7 @@ class ArrTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider getArray * @dataProvider getArray
*/ */
public function testSetMethodSetsItemsInArray($array) public function test_set_method_sets_items_in_array($array)
{ {
Arr::set($array, 'name', 'Taylor'); Arr::set($array, 'name', 'Taylor');
Arr::set($array, 'names.aunt', 'Tammy'); Arr::set($array, 'names.aunt', 'Tammy');
...@@ -37,7 +37,7 @@ class ArrTest extends PHPUnit_Framework_TestCase { ...@@ -37,7 +37,7 @@ class ArrTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider getArray * @dataProvider getArray
*/ */
public function testFirstMethodReturnsFirstItemPassingTruthTest($array) public function test_first_method_returns_first_item_passing_truth_test($array)
{ {
$array['email2'] = 'taylor@hotmail.com'; $array['email2'] = 'taylor@hotmail.com';
$this->assertEquals('taylorotwell@gmail.com', Arr::first($array, function($k, $v) {return substr($v, 0, 3) == 'tay';})); $this->assertEquals('taylorotwell@gmail.com', Arr::first($array, function($k, $v) {return substr($v, 0, 3) == 'tay';}));
...@@ -46,7 +46,7 @@ class ArrTest extends PHPUnit_Framework_TestCase { ...@@ -46,7 +46,7 @@ class ArrTest extends PHPUnit_Framework_TestCase {
/** /**
* @dataProvider getArray * @dataProvider getArray
*/ */
public function testFirstMethodReturnsDefaultWhenNoItemExists($array) 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->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';}, 'default'));
......
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