forked from UnDeAdYeTii/libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for the Arr::first() method
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Yetii\Tests\Arr; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use YeTii\General\Arr; | ||
|
||
/** | ||
* Class FirstTest | ||
*/ | ||
class FirstTest extends TestCase | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
public $testData = [ | ||
'apples', | ||
'oranges', | ||
'apples', | ||
]; | ||
|
||
/** | ||
* Test whether it shifts the first element off the array and returns this | ||
*/ | ||
public function testCanGetFirstArrayElement() | ||
{ | ||
$array = new Arr($this->testData); | ||
$result = $array->first(); | ||
|
||
$this->assertTrue($result === ['apples']); | ||
$this->assertTrue($array->toArray() === ['oranges', 'apples']); | ||
} | ||
} |