コード例 #1
0
 /**
  * @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'));
 }
コード例 #2
0
ファイル: ApiCommandTest.php プロジェクト: nickpeirson/guzzle
 /**
  * @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'));
 }
コード例 #3
0
ファイル: ApiCommandTest.php プロジェクト: jsnshrmn/Suma
 /**
  * @covers Guzzle\Service\Description\ApiCommand
  */
 public function testCanBuildUpCommands()
 {
     $c = new ApiCommand(array());
     $c->setName('foo')->setConcreteClass('Baz')->setDeprecated(false)->setDoc('doc')->setDocUrl('http://www.foo.com')->setMethod('PUT')->setResultDoc('oh')->setResultType('string')->setUri('/foo/bar')->addParam(new ApiParam(array('name' => 'test')));
     $this->assertEquals('foo', $c->getName());
     $this->assertEquals('Baz', $c->getConcreteClass());
     $this->assertEquals(false, $c->isDeprecated());
     $this->assertEquals('doc', $c->getDoc());
     $this->assertEquals('http://www.foo.com', $c->getDocUrl());
     $this->assertEquals('PUT', $c->getMethod());
     $this->assertEquals('oh', $c->getResultDoc());
     $this->assertEquals('string', $c->getResultType());
     $this->assertEquals('/foo/bar', $c->getUri());
     $this->assertEquals(array('test'), $c->getParamNames());
 }