|
@@ 290-296 (lines=7) @@
|
| 287 |
|
$this->getOrDefault(5, 'not found')->shouldReturn('not found'); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
function it_can_get_nth_item() |
| 291 |
|
{ |
| 292 |
|
$this->beConstructedWith([1, [2], 3]); |
| 293 |
|
$this->getNth(0)->shouldReturn(1); |
| 294 |
|
$this->getNth(1, true)->first()->shouldReturn(2); |
| 295 |
|
$this->getNth(1)->shouldReturn([2]); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
function it_can_find() |
| 299 |
|
{ |
|
@@ 826-832 (lines=7) @@
|
| 823 |
|
->shouldReturn([1 => 1, 3 => 2, 2 => 1]); |
| 824 |
|
} |
| 825 |
|
|
| 826 |
|
function it_can_get_first_item() |
| 827 |
|
{ |
| 828 |
|
$this->beConstructedWith([1, [2], 3]); |
| 829 |
|
$this->first()->shouldReturn(1); |
| 830 |
|
$this->drop(1)->first()->shouldReturn([2]); |
| 831 |
|
$this->drop(1)->first(true)->toArray()->shouldReturn([2]); |
| 832 |
|
} |
| 833 |
|
|
| 834 |
|
function it_will_throw_when_trying_to_get_first_item_of_empty_collection() |
| 835 |
|
{ |
|
@@ 840-846 (lines=7) @@
|
| 837 |
|
$this->shouldThrow(ItemNotFound::class)->during('first'); |
| 838 |
|
} |
| 839 |
|
|
| 840 |
|
function it_can_get_last_item() |
| 841 |
|
{ |
| 842 |
|
$this->beConstructedWith([1, [2], 3]); |
| 843 |
|
$this->last()->shouldReturn(3); |
| 844 |
|
$this->take(2)->last()->shouldReturn([2]); |
| 845 |
|
$this->take(2)->last(true)->toArray()->shouldReturn([2]); |
| 846 |
|
} |
| 847 |
|
|
| 848 |
|
function it_will_throw_when_trying_to_get_last_item_of_empty_collection() |
| 849 |
|
{ |