Skip to content

Commit

Permalink
test: Add missing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Oct 10, 2020
1 parent b680be9 commit a2217a8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/loophp/collection/CollectionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,22 @@ public function it_can_count_its_items(): void
->shouldReturn(3);
}

public function it_can_current(): void
{
$input = array_combine(
range('a', 'e'),
range(1, 5)
);

$this::fromIterable($input)
->current(0)
->shouldReturn(1);

$this::fromIterable($input)
->current(4)
->shouldReturn(5);
}

public function it_can_cycle(): void
{
$generator = static function (): Generator {
Expand Down Expand Up @@ -1351,6 +1367,22 @@ public function it_can_intersperse(): void
->during('all');
}

public function it_can_key(): void
{
$input = array_combine(
range('a', 'e'),
range(1, 5)
);

$this::fromIterable($input)
->key(0)
->shouldReturn('a');

$this::fromIterable($input)
->key(4)
->shouldReturn('e');
}

public function it_can_keys(): void
{
$this::fromIterable(range('A', 'E'))
Expand Down

0 comments on commit a2217a8

Please sign in to comment.