You are here

public function CartAccessApiResourceTest::testNoParameters in Commerce Cart API 8

Check access for route with no parameters (cart collection).

File

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

Class

CartAccessApiResourceTest
Tests cart api access check.

Namespace

Drupal\Tests\commerce_cart_api\Functional

Code

public function testNoParameters() {
  $request_options = $this
    ->getAuthenticationRequestOptions('GET');
  $url = Url::fromUri('base:cart');
  $url
    ->setOption('query', [
    '_format' => static::$format,
  ]);
  $cart = $this->cartProvider
    ->createCart('default', $this->store, $this->account);
  $this
    ->assertInstanceOf(OrderInterface::class, $cart);
  $response = $this
    ->request('GET', $url, $request_options);
  $this
    ->assertResourceResponse(200, FALSE, $response, [
    'commerce_order:1',
    'config:rest.resource.commerce_cart_collection',
    'config:rest.settings',
    'http_response',
  ], [
    'cart',
    'store',
  ], FALSE, 'MISS');
}