public function setUp() { $this->commandFactory = $this->getMock(self::CLASS_FACTORY, array('factory')); $guzzleClient = new Client(); $guzzleClient->setCommandFactory($this->commandFactory); $this->client = new JanusClient($guzzleClient); }
/** * @expectedException InvalidArgumentException */ public function testThrowsExceptionWhenMissingCommand() { $client = new Client(); $mock = $this->getMock('Guzzle\\Service\\Command\\Factory\\FactoryInterface'); $mock->expects($this->any())->method('factory')->with($this->equalTo('test'))->will($this->returnValue(null)); $client->setCommandFactory($mock); $client->getCommand('test'); }