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: 39: 40: 41: 42:
<?php
namespace Guzzle\Tests\Service\Resource;
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
use Guzzle\Tests\Service\Mock\Command\MockCommand;
class ResourceIteratorClassFactoryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testEnsuresIteratorClassExists()
{
$factory = new ResourceIteratorClassFactory(array('Foo', 'Bar'));
$factory->registerNamespace('Baz');
$command = new MockCommand();
$factory->build($command);
}
public function testBuildsResourceIterators()
{
$factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model');
$command = new MockCommand();
$iterator = $factory->build($command, array('client.namespace' => 'Guzzle\Tests\Service\Mock'));
$this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator);
}
public function testChecksIfCanBuild()
{
$factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service');
$this->assertFalse($factory->canBuild(new MockCommand()));
$factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model');
$this->assertTrue($factory->canBuild(new MockCommand()));
}
}