public function testContainsModels()
 {
     $d = new ServiceDescription(array('operations' => array('foo' => array()), 'models' => array('Tag' => array('type' => 'object'), 'Person' => array('type' => 'object'))));
     $this->assertTrue($d->hasModel('Tag'));
     $this->assertTrue($d->hasModel('Person'));
     $this->assertFalse($d->hasModel('Foo'));
     $this->assertInstanceOf('Guzzle\\Service\\Description\\Parameter', $d->getModel('Tag'));
     $this->assertNull($d->getModel('Foo'));
     $this->assertContains('"models":{', serialize($d));
 }
Ejemplo n.º 2
0
 public function testParsesResponsesUsingModelParserWhenMatchingModelIsFound()
 {
     $description = new ServiceDescription(array('operations' => array('foo' => array('responseClass' => 'bar', 'responseType' => 'model')), 'models' => array('bar' => array())));
     $op = new OperationCommand(array(), $description->getOperation('foo'));
     $op->setClient(new Client());
     $request = $op->prepare();
     $request->setResponse(new Response(200, array('Content-Type' => 'application/xml'), '<Foo><Baz>Bar</Baz></Foo>'), true);
     $this->assertEquals(new Model(array('Baz' => 'Bar'), $description->getModel('bar')), $op->execute());
 }