|
@@ 912-918 (lines=7) @@
|
| 909 |
|
->shouldReturn([1 => 1, 3 => 2, 2 => 1]); |
| 910 |
|
} |
| 911 |
|
|
| 912 |
|
function it_can_get_first_item() |
| 913 |
|
{ |
| 914 |
|
$this->beConstructedWith([1, [2], 3]); |
| 915 |
|
$this->first()->shouldReturn(1); |
| 916 |
|
$this->drop(1)->first()->shouldReturn([2]); |
| 917 |
|
$this->drop(1)->first(true)->toArray()->shouldReturn([2]); |
| 918 |
|
} |
| 919 |
|
|
| 920 |
|
function it_will_throw_when_trying_to_get_first_item_of_empty_collection() |
| 921 |
|
{ |
|
@@ 926-932 (lines=7) @@
|
| 923 |
|
$this->shouldThrow(ItemNotFound::class)->during('first'); |
| 924 |
|
} |
| 925 |
|
|
| 926 |
|
function it_can_get_last_item() |
| 927 |
|
{ |
| 928 |
|
$this->beConstructedWith([1, [2], 3]); |
| 929 |
|
$this->last()->shouldReturn(3); |
| 930 |
|
$this->take(2)->last()->shouldReturn([2]); |
| 931 |
|
$this->take(2)->last(true)->toArray()->shouldReturn([2]); |
| 932 |
|
} |
| 933 |
|
|
| 934 |
|
function it_will_throw_when_trying_to_get_last_item_of_empty_collection() |
| 935 |
|
{ |