for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ddeboer\DataImport\Tests\Reader;
use Ddeboer\DataImport\Reader\CountableIteratorReader;
/**
* @author Márk Sági-Kazár <[email protected]>
*/
class CountableIteratorReaderTest extends \PHPUnit_Framework_TestCase
{
public function testCount()
$iterator = new \ArrayIterator([
[
'id' => 1,
'username' => 'john.doe',
'name' => 'John Doe',
],
]);
$reader = new CountableIteratorReader($iterator);
// We need to rewind the iterator
$reader->rewind();
$this->assertEquals(1, $reader->count());
}
public function testIteratorCount()
$reader = new CountableIteratorReader(new CountableIterator);
$this->assertEquals(0, $reader->count());
class CountableIterator extends \EmptyIterator