Open Monograph Press  3.3.0
ConcreteClassFactoryTest.php
1 <?php
2 
4 
7 
12 {
13  public function testProvider()
14  {
15  return array(
16  array('foo', null, 'Guzzle\\Tests\\Service\\Mock\\Command\\'),
17  array('mock_command', 'Guzzle\Tests\Service\Mock\Command\MockCommand', 'Guzzle\\Tests\\Service\\Mock\\Command\\'),
18  array('other_command', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', 'Guzzle\\Tests\\Service\\Mock\\Command\\'),
19  array('sub.sub', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', 'Guzzle\\Tests\\Service\\Mock\\Command\\'),
20  array('sub.sub', null, 'Guzzle\\Foo\\'),
21  array('foo', null, null),
22  array('mock_command', 'Guzzle\Tests\Service\Mock\Command\MockCommand', null),
23  array('other_command', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', null),
24  array('sub.sub', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', null)
25  );
26  }
27 
31  public function testCreatesConcreteCommands($key, $result, $prefix)
32  {
33  if (!$prefix) {
34  $client = new MockClient();
35  } else {
36  $client = new MockClient('', array(
37  'command.prefix' => $prefix
38  ));
39  }
40 
41  $factory = new ConcreteClassFactory($client);
42 
43  if (is_null($result)) {
44  $this->assertNull($factory->factory($key));
45  } else {
46  $this->assertInstanceof($result, $factory->factory($key));
47  }
48  }
49 }
Guzzle\Tests\Service\Command\ConcreteClassFactoryTest\testProvider
testProvider()
Definition: ConcreteClassFactoryTest.php:13
Guzzle\Tests\GuzzleTestCase
Definition: GuzzleTestCase.php:22
Guzzle\Tests\Service\Command\ConcreteClassFactoryTest
Definition: ConcreteClassFactoryTest.php:11
Guzzle\Tests\Service\Mock\MockClient
Definition: MockClient.php:11
Guzzle\Service\Command\Factory\ConcreteClassFactory
Definition: ConcreteClassFactory.php:12
Guzzle\Tests\Service\Command\ConcreteClassFactoryTest\testCreatesConcreteCommands
testCreatesConcreteCommands($key, $result, $prefix)
Definition: ConcreteClassFactoryTest.php:31
Guzzle\Tests\Service\Command
Definition: AbstractCommandTest.php:3