public function CartCollectionResourceTest::testNoCartAvailable in Commerce Cart API 8
Tests that cart that doesn't belong to account can't be retrieved.
File
- tests/
src/ Functional/ CartCollectionResourceTest.php, line 32
Class
- CartCollectionResourceTest
- Tests the cart collection resource.
Namespace
Drupal\Tests\commerce_cart_api\FunctionalCode
public function testNoCartAvailable() {
$url = Url::fromUri('base:cart');
$url
->setOption('query', [
'_format' => static::$format,
]);
$request_options = $this
->getAuthenticationRequestOptions('GET');
$cart = $this->cartProvider
->createCart('default', $this->store);
$this
->assertInstanceOf(OrderInterface::class, $cart);
$response = $this
->request('GET', $url, $request_options);
$this
->assertResourceResponse(200, FALSE, $response, [
'config:rest.resource.commerce_cart_collection',
'config:rest.settings',
'http_response',
], [
'cart',
'store',
], FALSE, 'MISS');
$response_body = Json::decode((string) $response
->getBody());
$this
->assertEmpty($response_body);
}