Skip to content

Commit b0c88f6

Browse files
committed
add test
1 parent 0e40e85 commit b0c88f6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

app/code/Magento/Webapi/Controller/Rest/SynchronousRequestProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
9797
// phpcs:disable Magento2.Functions.DiscouragedFunction
9898
$outputData = call_user_func_array([$service, $serviceMethodName], $inputParams);
9999
// phpcs:enable Magento2.Functions.DiscouragedFunction
100-
} catch (\Throwable $e) {
100+
} catch (\TypeError $e) {
101101
throw new WebapiException(__($e->getMessage()));
102102
}
103103
$outputData = $this->serviceOutputProcessor->process(

dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipOrderTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@ public function testShipOrder()
181181
);
182182
}
183183

184+
/**
185+
* @magentoApiDataFixture Magento/Sales/_files/order_new.php
186+
*/
187+
public function testShipOrderWithTypeError()
188+
{
189+
/** @var Order $existingOrder */
190+
$existingOrder = $this->getOrder('100000001');
191+
192+
$requestData = [
193+
'orderId' => $existingOrder->getId(),
194+
'items' => "[]",
195+
];
196+
197+
$this->expectExceptionCode(400);
198+
$this->_webApiCall($this->getServiceInfo($existingOrder), $requestData);
199+
}
200+
184201
/**
185202
* Tests that not providing a tracking number produces the correct error. See MAGETWO-95429
186203
* @codingStandardsIgnoreStart

0 commit comments

Comments
 (0)