/**
  * @covers Guzzle\Service\Description\ApiCommand
  */
 public function testApiCommandIsDataObject()
 {
     $c = new ApiCommand(array('name' => 'test', 'doc' => 'doc', 'method' => 'POST', 'path' => '/api/v1', 'params' => array('key' => array('required' => 'true', 'type' => 'string', 'max_length' => 10), 'key_2' => array('required' => 'true', 'type' => 'integer', 'default' => 10))));
     $this->assertEquals('test', $c->getName());
     $this->assertEquals('doc', $c->getDoc());
     $this->assertEquals('POST', $c->getMethod());
     $this->assertEquals('/api/v1', $c->getUri());
     $this->assertEquals('Guzzle\\Service\\Command\\DynamicCommand', $c->getConcreteClass());
     $this->assertEquals(array('key' => new ApiParam(array('required' => 'true', 'type' => 'string', 'max_length' => 10)), 'key_2' => new ApiParam(array('required' => 'true', 'type' => 'integer', 'default' => 10))), $c->getParams());
     $this->assertEquals(new ApiParam(array('required' => 'true', 'type' => 'integer', 'default' => 10)), $c->getParam('key_2'));
     $this->assertNull($c->getParam('afefwef'));
 }
Example #2
0
 /**
  * @covers Guzzle\Service\Description\ApiCommand
  */
 public function testApiCommandIsDataObject()
 {
     $c = new ApiCommand(array('name' => 'test', 'doc' => 'doc', 'doc_url' => 'http://www.example.com', 'method' => 'POST', 'uri' => '/api/v1', 'result_type' => 'array', 'result_doc' => 'returns the json_decoded response', 'deprecated' => true, 'params' => array('key' => array('required' => 'true', 'type' => 'string', 'max_length' => 10), 'key_2' => array('required' => 'true', 'type' => 'integer', 'default' => 10))));
     $this->assertEquals('test', $c->getName());
     $this->assertEquals('doc', $c->getDoc());
     $this->assertEquals('http://www.example.com', $c->getDocUrl());
     $this->assertEquals('POST', $c->getMethod());
     $this->assertEquals('/api/v1', $c->getUri());
     $this->assertEquals('array', $c->getResultType());
     $this->assertEquals('returns the json_decoded response', $c->getResultDoc());
     $this->assertTrue($c->isDeprecated());
     $this->assertEquals('Guzzle\\Service\\Command\\DynamicCommand', $c->getConcreteClass());
     $this->assertEquals(array('key' => new ApiParam(array('name' => 'key', 'required' => 'true', 'type' => 'string', 'max_length' => 10)), 'key_2' => new ApiParam(array('name' => 'key_2', 'required' => 'true', 'type' => 'integer', 'default' => 10))), $c->getParams());
     $this->assertEquals(new ApiParam(array('name' => 'key_2', 'required' => 'true', 'type' => 'integer', 'default' => 10)), $c->getParam('key_2'));
     $this->assertNull($c->getParam('afefwef'));
 }