/** * @expectedException \GuzzleHttp\Command\Exception\CommandException * @expectedExceptionMessage 404 */ public function testDoesNotAddResultWhenExceptionIsPresent() { $description = new Description(['operations' => ['foo' => ['uri' => 'http://httpbin.org/{foo}', 'httpMethod' => 'GET', 'responseModel' => 'j', 'parameters' => ['bar' => ['type' => 'string', 'required' => true, 'location' => 'uri']]]]]); $client = new GuzzleClient(new Client(), $description); $client->getHttpClient()->getEmitter()->attach(new Mock([new Response(404)])); $client->foo(['bar' => 'baz']); }
public function testHasConfig() { $client = new Client(); $description = new Description([]); $guzzle = new GuzzleClient($client, $description, ['foo' => 'bar', 'baz' => ['bam' => 'boo']]); $this->assertSame($client, $guzzle->getHttpClient()); $this->assertSame($description, $guzzle->getDescription()); $this->assertEquals('bar', $guzzle->getConfig('foo')); $this->assertEquals('boo', $guzzle->getConfig('baz/bam')); $this->assertEquals([], $guzzle->getConfig('defaults')); $guzzle->setConfig('abc/123', 'listen'); $this->assertEquals('listen', $guzzle->getConfig('abc/123')); $this->assertCount(1, $guzzle->getEmitter()->listeners('process')); }