@@ 900-906 (lines=7) @@ | ||
897 | ->shouldReturn([1 => 1, 3 => 2, 2 => 1]); |
|
898 | } |
|
899 | ||
900 | function it_can_get_first_item() |
|
901 | { |
|
902 | $this->beConstructedWith([1, [2], 3]); |
|
903 | $this->first()->shouldReturn(1); |
|
904 | $this->drop(1)->first()->shouldReturn([2]); |
|
905 | $this->drop(1)->first(true)->toArray()->shouldReturn([2]); |
|
906 | } |
|
907 | ||
908 | function it_will_throw_when_trying_to_get_first_item_of_empty_collection() |
|
909 | { |
|
@@ 914-920 (lines=7) @@ | ||
911 | $this->shouldThrow(ItemNotFound::class)->during('first'); |
|
912 | } |
|
913 | ||
914 | function it_can_get_last_item() |
|
915 | { |
|
916 | $this->beConstructedWith([1, [2], 3]); |
|
917 | $this->last()->shouldReturn(3); |
|
918 | $this->take(2)->last()->shouldReturn([2]); |
|
919 | $this->take(2)->last(true)->toArray()->shouldReturn([2]); |
|
920 | } |
|
921 | ||
922 | function it_will_throw_when_trying_to_get_last_item_of_empty_collection() |
|
923 | { |