You are here

public function CartAccessApiResourceTest::testNoCart in Commerce Cart API 8

Check no access for missing cart (cart canonical).

File

tests/src/Functional/CartAccessApiResourceTest.php, line 60

Class

CartAccessApiResourceTest
Tests cart api access check.

Namespace

Drupal\Tests\commerce_cart_api\Functional

Code

public function testNoCart() {
  $request_options = $this
    ->getAuthenticationRequestOptions('GET');

  // Request for cart that does not exist.
  $url = Url::fromUri('base:cart/99');
  $url
    ->setOption('query', [
    '_format' => static::$format,
  ]);
  $response = $this
    ->request('GET', $url, $request_options);
  $this
    ->assertResourceErrorResponse(404, 'The "commerce_order" parameter was not converted for the path "/cart/{commerce_order}" (route name: "rest.commerce_cart_canonical.GET")', $response);
}