You are here

public function CartRemoveItemResourceTest::testNoCartRemoveItem in Commerce Cart API 8

Test request to delete item from non-existent cart.

File

tests/src/Functional/CartRemoveItemResourceTest.php, line 32

Class

CartRemoveItemResourceTest
Tests the cart remove item resource.

Namespace

Drupal\Tests\commerce_cart_api\Functional

Code

public function testNoCartRemoveItem() {
  $request_options = $this
    ->getAuthenticationRequestOptions('DELETE');
  $url = Url::fromUri('base:cart/1/items/1');
  $url
    ->setOption('query', [
    '_format' => static::$format,
  ]);
  $response = $this
    ->request('DELETE', $url, $request_options);
  $this
    ->assertResourceErrorResponse(404, 'The "commerce_order" parameter was not converted for the path "/cart/{commerce_order}/items/{commerce_order_item}" (route name: "rest.commerce_cart_remove_item.DELETE")', $response);
}