コード例 #1
0
 public function testOperationIsDataObject()
 {
     $c = new Operation(array('name' => 'test', 'summary' => 'doc', 'notes' => 'notes', 'documentationUrl' => 'http://www.example.com', 'httpMethod' => 'POST', 'uri' => '/api/v1', 'responseClass' => 'array', 'responseNotes' => 'returns the json_decoded response', 'deprecated' => true, 'parameters' => array('key' => array('required' => true, 'type' => 'string', 'maxLength' => 10), 'key_2' => array('required' => true, 'type' => 'integer', 'default' => 10))));
     $this->assertEquals('test', $c->getName());
     $this->assertEquals('doc', $c->getSummary());
     $this->assertEquals('http://www.example.com', $c->getDocumentationUrl());
     $this->assertEquals('POST', $c->getHttpMethod());
     $this->assertEquals('/api/v1', $c->getUri());
     $this->assertEquals('array', $c->getResponseClass());
     $this->assertEquals('returns the json_decoded response', $c->getResponseNotes());
     $this->assertTrue($c->getDeprecated());
     $this->assertEquals('Guzzle\\Service\\Command\\OperationCommand', $c->getClass());
     $this->assertEquals(array('key' => new Parameter(array('name' => 'key', 'required' => true, 'type' => 'string', 'maxLength' => 10, 'parent' => $c)), 'key_2' => new Parameter(array('name' => 'key_2', 'required' => true, 'type' => 'integer', 'default' => 10, 'parent' => $c))), $c->getParams());
     $this->assertEquals(new Parameter(array('name' => 'key_2', 'required' => true, 'type' => 'integer', 'default' => 10, 'parent' => $c)), $c->getParam('key_2'));
     $this->assertNull($c->getParam('afefwef'));
     $this->assertArrayNotHasKey('parent', $c->getParam('key_2')->toArray());
 }