|
@@ 265-271 (lines=7) @@
|
| 262 |
|
$this->getOrDefault(5, 'not found')->shouldReturn('not found'); |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
function it_can_get_nth_item() |
| 266 |
|
{ |
| 267 |
|
$this->beConstructedWith([1, [2], 3]); |
| 268 |
|
$this->getNth(0)->shouldReturn(1); |
| 269 |
|
$this->getNth(1, true)->first()->shouldReturn(2); |
| 270 |
|
$this->getNth(1)->shouldReturn([2]); |
| 271 |
|
} |
| 272 |
|
|
| 273 |
|
function it_can_find() |
| 274 |
|
{ |
|
@@ 807-813 (lines=7) @@
|
| 804 |
|
->shouldReturn([1 => 1, 3 => 2, 2 => 1]); |
| 805 |
|
} |
| 806 |
|
|
| 807 |
|
function it_can_get_first_item() |
| 808 |
|
{ |
| 809 |
|
$this->beConstructedWith([1, [2], 3]); |
| 810 |
|
$this->first()->shouldReturn(1); |
| 811 |
|
$this->drop(1)->first()->shouldReturn([2]); |
| 812 |
|
$this->drop(1)->first(true)->toArray()->shouldReturn([2]); |
| 813 |
|
} |
| 814 |
|
|
| 815 |
|
function it_will_throw_when_trying_to_get_first_item_of_empty_collection() |
| 816 |
|
{ |
|
@@ 821-827 (lines=7) @@
|
| 818 |
|
$this->shouldThrow(ItemNotFound::class)->during('first'); |
| 819 |
|
} |
| 820 |
|
|
| 821 |
|
function it_can_get_last_item() |
| 822 |
|
{ |
| 823 |
|
$this->beConstructedWith([1, [2], 3]); |
| 824 |
|
$this->last()->shouldReturn(3); |
| 825 |
|
$this->take(2)->last()->shouldReturn([2]); |
| 826 |
|
$this->take(2)->last(true)->toArray()->shouldReturn([2]); |
| 827 |
|
} |
| 828 |
|
|
| 829 |
|
function it_will_throw_when_trying_to_get_last_item_of_empty_collection() |
| 830 |
|
{ |