|
3 | 3 | * Copyright © Magento, Inc. All rights reserved.
|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
| 6 | + |
6 | 7 | namespace Magento\Webapi\Test\Unit\Model\Rest\Swagger;
|
7 | 8 |
|
8 | 9 | /**
|
@@ -137,11 +138,7 @@ public function testGenerate($serviceMetadata, $typeData, $schema)
|
137 | 138 | ->willReturn($serviceMetadata);
|
138 | 139 | $this->typeProcessorMock->expects($this->any())
|
139 | 140 | ->method('getTypeData')
|
140 |
| - ->willReturnMap( |
141 |
| - [ |
142 |
| - ['TestModule5V2EntityAllSoapAndRest', $typeData], |
143 |
| - ] |
144 |
| - ); |
| 141 | + ->willReturnMap($typeData); |
145 | 142 |
|
146 | 143 | $this->typeProcessorMock->expects($this->any())
|
147 | 144 | ->method('isTypeSimple')
|
@@ -169,6 +166,96 @@ public function testGenerate($serviceMetadata, $typeData, $schema)
|
169 | 166 | public function generateDataProvider()
|
170 | 167 | {
|
171 | 168 | return [
|
| 169 | + [ |
| 170 | + [ |
| 171 | + 'methods' => [ |
| 172 | + 'execute' => [ |
| 173 | + 'method' => 'execute', |
| 174 | + 'inputRequired' => false, |
| 175 | + 'isSecure' => false, |
| 176 | + 'resources' => [ |
| 177 | + "anonymous" |
| 178 | + ], |
| 179 | + 'methodAlias' => 'execute', |
| 180 | + 'parameters' => [], |
| 181 | + 'documentation' => 'Do Magic!', |
| 182 | + 'interface' => [ |
| 183 | + 'in' => [ |
| 184 | + 'parameters' => [ |
| 185 | + 'searchRequest' => [ |
| 186 | + 'type' => 'DreamVendorDreamModuleApiDataSearchRequestInterface', |
| 187 | + 'required' => true, |
| 188 | + 'documentation' => "" |
| 189 | + ] |
| 190 | + ] |
| 191 | + ], |
| 192 | + 'out' => [ |
| 193 | + 'parameters' => [ |
| 194 | + 'result' => [ |
| 195 | + 'type' => 'DreamVendorDreamModuleApiDataSearchResultInterface', |
| 196 | + 'documentation' => null, |
| 197 | + 'required' => true |
| 198 | + ] |
| 199 | + ] |
| 200 | + ] |
| 201 | + ] |
| 202 | + ] |
| 203 | + ], |
| 204 | + 'class' => 'DreamVendor\DreamModule\Api\ExecuteStuff', |
| 205 | + 'description' => '', |
| 206 | + 'routes' => [ |
| 207 | + '/V1/dream-vendor/dream-module/execute-stuff' => [ |
| 208 | + 'GET' => [ |
| 209 | + 'method' => 'execute', |
| 210 | + 'parameters' => [] |
| 211 | + ] |
| 212 | + ] |
| 213 | + ] |
| 214 | + ], |
| 215 | + [ |
| 216 | + [ |
| 217 | + 'DreamVendorDreamModuleApiDataSearchRequestInterface', |
| 218 | + [ |
| 219 | + 'documentation' => '', |
| 220 | + 'parameters' => [ |
| 221 | + 'stuff' => [ |
| 222 | + 'type' => 'DreamVendorDreamModuleApiDataStuffInterface', |
| 223 | + 'required' => true, |
| 224 | + 'documentation' => 'Empty Extension Point' |
| 225 | + ] |
| 226 | + ] |
| 227 | + ] |
| 228 | + ], |
| 229 | + [ |
| 230 | + 'DreamVendorDreamModuleApiDataSearchResultInterface', |
| 231 | + [ |
| 232 | + 'documentation' => '', |
| 233 | + 'parameters' => [ |
| 234 | + 'totalCount' => [ |
| 235 | + 'type' => 'int', |
| 236 | + 'required' => true, |
| 237 | + 'documentation' => 'Processed count.' |
| 238 | + ], |
| 239 | + 'stuff' => [ |
| 240 | + 'type' => 'DreamVendorDreamModuleApiDataStuffInterface', |
| 241 | + 'required' => true, |
| 242 | + 'documentation' => 'Empty Extension Point' |
| 243 | + ] |
| 244 | + ] |
| 245 | + ] |
| 246 | + ], |
| 247 | + [ |
| 248 | + 'DreamVendorDreamModuleApiDataStuffInterface', |
| 249 | + [ |
| 250 | + 'documentation' => '', |
| 251 | + 'parameters' => [] |
| 252 | + ] |
| 253 | + ] |
| 254 | + ], |
| 255 | + // @codingStandardsIgnoreStart |
| 256 | + '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":""}],"paths":{"/V1/dream-vendor/dream-module/execute-stuff":{"get":{"tags":["testModule5AllSoapAndRestV2"],"description":"Do Magic!","operationId":"operationNameGet","consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/dream-vendor-dream-module-api-data-search-result-interface"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"dream-vendor-dream-module-api-data-search-result-interface":{"type":"object","description":"","properties":{"total_count":{"type":"integer","description":"Processed count."},"stuff":{"$ref":"#/definitions/dream-vendor-dream-module-api-data-stuff-interface"}},"required":["total_count","stuff"]},"dream-vendor-dream-module-api-data-stuff-interface":{"type":"object","description":""}}}' |
| 257 | + // @codingStandardsIgnoreEnd |
| 258 | + ], |
172 | 259 | [
|
173 | 260 | [
|
174 | 261 | 'methods' => [
|
@@ -213,12 +300,17 @@ public function generateDataProvider()
|
213 | 300 | ],
|
214 | 301 | ],
|
215 | 302 | [
|
216 |
| - 'documentation' => 'Some Data Object', |
217 |
| - 'parameters' => [ |
218 |
| - 'price' => [ |
219 |
| - 'type' => 'int', |
220 |
| - 'required' => true, |
221 |
| - 'documentation' => "" |
| 303 | + [ |
| 304 | + 'TestModule5V2EntityAllSoapAndRest', |
| 305 | + [ |
| 306 | + 'documentation' => 'Some Data Object', |
| 307 | + 'parameters' => [ |
| 308 | + 'price' => [ |
| 309 | + 'type' => 'int', |
| 310 | + 'required' => true, |
| 311 | + 'documentation' => "" |
| 312 | + ] |
| 313 | + ] |
222 | 314 | ]
|
223 | 315 | ]
|
224 | 316 | ],
|
@@ -261,12 +353,17 @@ public function generateDataProvider()
|
261 | 353 | ],
|
262 | 354 | ],
|
263 | 355 | [
|
264 |
| - 'documentation' => 'Some Data Object', |
265 |
| - 'parameters' => [ |
266 |
| - 'price' => [ |
267 |
| - 'type' => 'int', |
268 |
| - 'required' => true, |
269 |
| - 'documentation' => "" |
| 356 | + [ |
| 357 | + 'TestModule5V2EntityAllSoapAndRest', |
| 358 | + [ |
| 359 | + 'documentation' => 'Some Data Object', |
| 360 | + 'parameters' => [ |
| 361 | + 'price' => [ |
| 362 | + 'type' => 'int', |
| 363 | + 'required' => true, |
| 364 | + 'documentation' => "" |
| 365 | + ] |
| 366 | + ] |
270 | 367 | ]
|
271 | 368 | ]
|
272 | 369 | ],
|
|
0 commit comments