public function CartUpdateItemResourceTest::testMissingCart in Commerce Cart API 8
Tests patch when cart does not exist.
File
- tests/
src/ Functional/ CartUpdateItemResourceTest.php, line 34
Class
- CartUpdateItemResourceTest
- Tests the cart update items resource.
Namespace
Drupal\Tests\commerce_cart_api\FunctionalCode
public function testMissingCart() {
$request_options = $this
->getAuthenticationRequestOptions('PATCH');
$request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType;
$url = Url::fromUri('base:cart/1/items/1');
$url
->setOption('query', [
'_format' => static::$format,
]);
$request_options[RequestOptions::BODY] = '{"quantity":"1"}';
$response = $this
->request('PATCH', $url, $request_options);
$this
->assertResourceErrorResponse(404, FALSE, $response);
}