diff options
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php')
-rw-r--r-- | vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php new file mode 100644 index 0000000..7664718 --- /dev/null +++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php @@ -0,0 +1,49 @@ +<?php + +namespace Guzzle\Tests\Service\Command; + +use Guzzle\Tests\Service\Mock\MockClient; +use Guzzle\Service\Command\Factory\ConcreteClassFactory; + +/** + * @covers Guzzle\Service\Command\Factory\ConcreteClassFactory + */ +class ConcreteClassFactoryTest extends \Guzzle\Tests\GuzzleTestCase +{ + public function testProvider() + { + return array( + array('foo', null, 'Guzzle\\Tests\\Service\\Mock\\Command\\'), + array('mock_command', 'Guzzle\Tests\Service\Mock\Command\MockCommand', 'Guzzle\\Tests\\Service\\Mock\\Command\\'), + array('other_command', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', 'Guzzle\\Tests\\Service\\Mock\\Command\\'), + array('sub.sub', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', 'Guzzle\\Tests\\Service\\Mock\\Command\\'), + array('sub.sub', null, 'Guzzle\\Foo\\'), + array('foo', null, null), + array('mock_command', 'Guzzle\Tests\Service\Mock\Command\MockCommand', null), + array('other_command', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', null), + array('sub.sub', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', null) + ); + } + + /** + * @dataProvider testProvider + */ + public function testCreatesConcreteCommands($key, $result, $prefix) + { + if (!$prefix) { + $client = new MockClient(); + } else { + $client = new MockClient('', array( + 'command.prefix' => $prefix + )); + } + + $factory = new ConcreteClassFactory($client); + + if (is_null($result)) { + $this->assertNull($factory->factory($key)); + } else { + $this->assertInstanceof($result, $factory->factory($key)); + } + } +} |