public function CheckoutAccessTest::testOwnerCheckoutAccess in Commerce Core 8.2
Tests that only the order's owner can view its checkout.
File
- modules/
checkout/ tests/ src/ Kernel/ CheckoutAccessTest.php, line 113
Class
- CheckoutAccessTest
- Tests the checkout access for orders.
Namespace
Drupal\Tests\commerce_checkout\KernelCode
public function testOwnerCheckoutAccess() {
$user1 = $this
->createUser([], [
'access checkout',
]);
$user2 = $this
->createUser([], [
'access checkout',
]);
/** @var \Drupal\commerce_order\Entity\Order $order */
$order = $this
->createOrder($user1);
$request = $this
->createRequest($order);
$this
->assertTrue($this->accessManager
->checkRequest($request, $user1));
$this
->assertFalse($this->accessManager
->checkRequest($request, $user2));
}