Skip to content

Commit

Permalink
#84: fixed coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGoryunov committed Sep 8, 2021
1 parent b2d550d commit 291fea3
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/src/ValidAddingIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,48 @@ public function testDoesNotAddValuesIfSourceIsNotValid(): void
$iterator->from(new ArrayIterator())
);
}

/**
* @covers ::__construct
* @covers ::from
*
* @uses MaxGoryunov\SavingIterator\Src\ArrayAddingIterator
*
* @small
*
* @return void
*/
public function testAddsValuesIfSourceIsValid(): void
{
$iterator = new ValidAddingIterator(new ArrayAddingIterator());
$this->assertNotSame(
$iterator,
$iterator->from(new ArrayIterator([34, 7, 23, 81, 75, 16]))
);
}

/**
* @covers ::__construct
* @covers ::current
* @covers ::key
* @covers ::valid
* @covers ::next
* @covers ::rewind
*
* @uses MaxGoryunov\SavingIterator\Src\ArrayAddingIterator
*
* @small
*
* @return void
*/
public function testBehavesAsIterator(): void
{
$input = [34, 7, 85, 72, 54, 71, 8];
$this->assertEquals(
$input,
iterator_to_array(
new ValidAddingIterator(new ArrayAddingIterator($input))
)
);
}
}

0 comments on commit 291fea3

Please sign in to comment.