Skip to content

Commit

Permalink
Improving code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Sep 30, 2019
1 parent 09b4dab commit 4525540
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/EmptyInnerResultIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public function testIterate()
foreach ($iterator as $elem) {
$this->fail('Iterator should be empty');
}
$this->assertTrue(true);

$iterator->next();
$this->assertNull($iterator->current());
$this->assertNull($iterator->key());
}

public function testOffsetGet()
Expand Down
21 changes: 21 additions & 0 deletions tests/MapIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,31 @@

namespace TheCodingMachine\TDBM;

use ArrayIterator;
use IteratorAggregate;
use PHPUnit\Framework\TestCase;

class MapIteratorTest extends TestCase
{
public function testIteratorAggregate(): void
{
$mapIterator = new MapIterator(new class implements IteratorAggregate
{
public $property1 = "Public property one";
public $property2 = "Public property two";
public $property3 = "Public property three";

public function getIterator()
{
return new ArrayIterator($this);
}
}, function ($item) {
return $item;
});

self::assertCount(3, $mapIterator);
}

public function testConstructorException1(): void
{
$this->expectException('TheCodingMachine\TDBM\TDBMException');
Expand Down

0 comments on commit 4525540

Please sign in to comment.