public function testUsesInflectionIfNoExactMatch()
 {
     $d = $this->getDescription();
     $factory = new ServiceDescriptionFactory($d, new Inflector());
     $this->assertInstanceof('Guzzle\\Tests\\Service\\Mock\\Command\\OtherCommand', $factory->factory('Binks'));
     $this->assertInstanceof('Guzzle\\Tests\\Service\\Mock\\Command\\OtherCommand', $factory->factory('binks'));
     $this->assertInstanceof('Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', $factory->factory('JarJar'));
     $this->assertInstanceof('Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', $factory->factory('jar_jar'));
 }
 /**
  * @covers Guzzle\Service\Command\Factory\ServiceDescriptionFactory
  * @dataProvider testProvider
  */
 public function testCreatesCommandsUsingServiceDescriptions($key, $result)
 {
     $d = ServiceDescription::factory(array('commands' => array('jarjar' => array('class' => 'Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand'), 'binks' => array('class' => 'Guzzle\\Tests\\Service\\Mock\\Command\\OtherCommand'))));
     $factory = new ServiceDescriptionFactory($d);
     $this->assertSame($d, $factory->getServiceDescription());
     if (is_null($result)) {
         $this->assertNull($factory->factory($key));
     } else {
         $this->assertInstanceof($result, $factory->factory($key));
     }
 }
Exemplo n.º 3
0
 /**
  * @covers Guzzle\Service\Command\DynamicCommand::build
  */
 public function testBuildsConcreteCommands()
 {
     $c = $this->factory->factory('concrete');
     $this->assertEquals('Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', get_class($c));
 }