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: 30: 31: 32: 33: 34: 35: 36: 37: 38:
<?php
namespace Guzzle\Tests\Service\Resource;
use Guzzle\Service\Resource\CompositeResourceIteratorFactory;
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
use Guzzle\Tests\Service\Mock\Command\MockCommand;
class CompositeResourceIteratorFactoryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testEnsuresIteratorClassExists()
{
$factory = new CompositeResourceIteratorFactory(array(
new ResourceIteratorClassFactory(array('Foo', 'Bar'))
));
$cmd = new MockCommand();
$this->assertFalse($factory->canBuild($cmd));
$factory->build($cmd);
}
public function testBuildsResourceIterators()
{
$f1 = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model');
$factory = new CompositeResourceIteratorFactory(array());
$factory->addFactory($f1);
$command = new MockCommand();
$iterator = $factory->build($command, array('client.namespace' => 'Guzzle\Tests\Service\Mock'));
$this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator);
}
}