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:
<?php
namespace Guzzle\Tests\Service\Resource;
use Guzzle\Service\Resource\MapResourceIteratorFactory;
use Guzzle\Tests\Service\Mock\Command\MockCommand;
class MapResourceIteratorFactoryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testEnsuresIteratorClassExists()
{
$factory = new MapResourceIteratorFactory(array('Foo', 'Bar'));
$factory->build(new MockCommand());
}
public function testBuildsResourceIterators()
{
$factory = new MapResourceIteratorFactory(array(
'mock_command' => 'Guzzle\Tests\Service\Mock\Model\MockCommandIterator'
));
$iterator = $factory->build(new MockCommand());
$this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator);
}
public function testUsesWildcardMappings()
{
$factory = new MapResourceIteratorFactory(array(
'*' => 'Guzzle\Tests\Service\Mock\Model\MockCommandIterator'
));
$iterator = $factory->build(new MockCommand());
$this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator);
}
}