17 'baz' => array(
'bar'),
18 'apiVersion' =>
'123',
19 'operations' => array()
22 $this->assertEquals(
true, $d->getData(
'foo'));
23 $this->assertEquals(array(
'bar'), $d->getData(
'baz'));
24 $this->assertEquals(
'123', $d->getApiVersion());
30 'operations' => array(
32 'httpMethod' =>
'HEAD',
33 'parameters' => array(
34 'test' => array(
'type' =>
'string',
'required' =>
true)
37 'abstract2' => array(
'uri' =>
'/test',
'extends' =>
'abstract'),
38 'concrete' => array(
'extends' =>
'abstract2'),
39 'override' => array(
'extends' =>
'abstract',
'httpMethod' =>
'PUT'),
40 'override2' => array(
'extends' =>
'override',
'httpMethod' =>
'POST',
'uri' =>
'/')
44 $c = $d->getOperation(
'concrete');
45 $this->assertEquals(
'/test', $c->getUri());
46 $this->assertEquals(
'HEAD', $c->getHttpMethod());
47 $params = $c->getParams();
48 $param = $params[
'test'];
49 $this->assertEquals(
'string', $param->getType());
50 $this->assertTrue($param->getRequired());
53 $this->assertEquals(
'PUT', $d->getOperation(
'override')->getHttpMethod());
54 $this->assertEquals(
'POST', $d->getOperation(
'override2')->getHttpMethod());
55 $this->assertEquals(
'/', $d->getOperation(
'override2')->getUri());
64 'operations' => array(
66 'extends' =>
'missing'
75 'operations' => array(
77 'httpMethod' =>
'GET',
78 'parameters' => array(
88 'parameters' => array(
93 'parameters' => array(
97 'description' =>
'test'
103 'httpMethod' =>
'DELETE',
104 'extends' => array(
'b',
'c'),
105 'parameters' => array(
112 $command = $description->getOperation(
'd');
113 $this->assertEquals(
'DELETE', $command->getHttpMethod());
114 $this->assertContains(
'a1', $command->getParamNames());
115 $this->assertContains(
'b2', $command->getParamNames());
116 $this->assertContains(
'c3', $command->getParamNames());
117 $this->assertContains(
'test', $command->getParamNames());
119 $this->assertTrue($command->getParam(
'a1')->getRequired());
120 $this->assertEquals(
'bar', $command->getParam(
'a1')->getDefault());
121 $this->assertEquals(
'test', $command->getParam(
'a1')->getDescription());
127 'operations' => array(),
128 'description' =>
'Foo',
129 'apiVersion' =>
'bar'
131 $this->assertEquals(
'Foo', $description->getDescription());
132 $this->assertEquals(
'bar', $description->getApiVersion());
138 'operations' => array(
144 'parameters' => array(
145 'baz' => array(
'type' =>
'string')
150 'parameters' => array(
151 'bar' => array(
'type' =>
'string')
156 'parameters' => array(
157 'bar2' => array(
'type' =>
'string')
161 'extends' => array(
'foo_2',
'foo_3'),
162 'parameters' => array(
163 'bar3' => array(
'type' =>
'string')
169 $this->assertTrue($description->hasOperation(
'foo_4'));
170 $foo4 = $description->getOperation(
'foo_4');
171 $this->assertTrue($foo4->hasParam(
'baz'));
172 $this->assertTrue($foo4->hasParam(
'bar'));
173 $this->assertTrue($foo4->hasParam(
'bar2'));
174 $this->assertTrue($foo4->hasParam(
'bar3'));
175 $this->assertEquals(
'bar', $foo4->getClass());