public function CheckoutAccessTest::testAccessCheckoutPermission in Commerce Core 8.2
Tests that users need the `access checkout` permission.
File
- modules/
checkout/ tests/ src/ Kernel/ CheckoutAccessTest.php, line 97
Class
- CheckoutAccessTest
- Tests the checkout access for orders.
Namespace
Drupal\Tests\commerce_checkout\KernelCode
public function testAccessCheckoutPermission() {
$user_with_access = $this
->createUser([], [
'access checkout',
]);
$user_without_access = $this
->createUser([], []);
$order = $this
->createOrder($user_with_access);
$request = $this
->createRequest($order);
$this
->assertTrue($this->accessManager
->checkRequest($request, $user_with_access));
$order = $this
->createOrder($user_without_access);
$request = $this
->createRequest($order);
$this
->assertFalse($this->accessManager
->checkRequest($request, $user_without_access));
}