public function PaymentMethodAccessTest::testCreateAccess in Commerce Core 8.2
@covers ::checkCreateAccess
File
- modules/
payment/ tests/ src/ Kernel/ PaymentMethodAccessTest.php, line 197
Class
- PaymentMethodAccessTest
- Tests the payment method access control.
Namespace
Drupal\Tests\commerce_payment\KernelCode
public function testCreateAccess() {
$access_control_handler = \Drupal::entityTypeManager()
->getAccessControlHandler('commerce_payment_method');
$account = $this
->createUser([], [
'access content',
]);
$this
->assertFalse($access_control_handler
->createAccess('credit_card', $account));
$account = $this
->createUser([], [
'administer commerce_payment_method',
]);
$this
->assertTrue($access_control_handler
->createAccess('credit_card', $account));
$account = $this
->createUser([], [
'manage own commerce_payment_method',
]);
$this
->assertTrue($access_control_handler
->createAccess('credit_card', $account));
}