Skip to content

Commit

Permalink
Added tests for the Arr::first() method
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Oct 17, 2017
1 parent cbf133f commit c9cbaa0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Arr/FirstTest.php
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']);
}
}

0 comments on commit c9cbaa0

Please sign in to comment.