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\Command;
use Guzzle\Service\Command\Factory\MapFactory;
class MapFactoryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function mapProvider()
{
return array(
array('foo', null),
array('test', 'Guzzle\Tests\Service\Mock\Command\MockCommand'),
array('test1', 'Guzzle\Tests\Service\Mock\Command\OtherCommand')
);
}
public function testCreatesCommandsUsingMappings($key, $result)
{
$factory = new MapFactory(array(
'test' => 'Guzzle\Tests\Service\Mock\Command\MockCommand',
'test1' => 'Guzzle\Tests\Service\Mock\Command\OtherCommand'
));
if (is_null($result)) {
$this->assertNull($factory->factory($key));
} else {
$this->assertInstanceof($result, $factory->factory($key));
}
}
}