|
@@ 964-970 (lines=7) @@
|
| 961 |
|
->shouldReturn([1 => 1, 3 => 2, 2 => 1]); |
| 962 |
|
} |
| 963 |
|
|
| 964 |
|
function it_can_get_first_item() |
| 965 |
|
{ |
| 966 |
|
$this->beConstructedWith([1, [2], 3]); |
| 967 |
|
$this->first()->shouldReturn(1); |
| 968 |
|
$this->drop(1)->first()->shouldReturn([2]); |
| 969 |
|
$this->drop(1)->first(true)->toArray()->shouldReturn([2]); |
| 970 |
|
} |
| 971 |
|
|
| 972 |
|
function it_will_throw_when_trying_to_get_first_item_of_empty_collection() |
| 973 |
|
{ |
|
@@ 978-984 (lines=7) @@
|
| 975 |
|
$this->shouldThrow(ItemNotFound::class)->during('first'); |
| 976 |
|
} |
| 977 |
|
|
| 978 |
|
function it_can_get_last_item() |
| 979 |
|
{ |
| 980 |
|
$this->beConstructedWith([1, [2], 3]); |
| 981 |
|
$this->last()->shouldReturn(3); |
| 982 |
|
$this->take(2)->last()->shouldReturn([2]); |
| 983 |
|
$this->take(2)->last(true)->toArray()->shouldReturn([2]); |
| 984 |
|
} |
| 985 |
|
|
| 986 |
|
function it_will_throw_when_trying_to_get_last_item_of_empty_collection() |
| 987 |
|
{ |