1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29:
<?php
namespace Guzzle\Tests\Iterator;
use Guzzle\Iterator\FilterIterator;
class FilterIteratorTest extends \PHPUnit_Framework_TestCase
{
public function testFiltersValues()
{
$i = new FilterIterator(new \ArrayIterator(range(0, 100)), function ($value) {
return $value % 2;
});
$this->assertEquals(range(1, 99, 2), iterator_to_array($i, false));
}
public function testValidatesCallable()
{
$i = new FilterIterator(new \ArrayIterator(), new \stdClass());
}
}