public function CouponAccessTest::testCreateAccess in Commerce Core 8.2
@covers ::checkCreateAccess
File
- modules/
promotion/ tests/ src/ Kernel/ CouponAccessTest.php, line 82
Class
- CouponAccessTest
- Tests the coupon access control.
Namespace
Drupal\Tests\commerce_promotion\KernelCode
public function testCreateAccess() {
$access_control_handler = \Drupal::entityTypeManager()
->getAccessControlHandler('commerce_promotion_coupon');
$account = $this
->createUser([], [
'access content',
]);
$this
->assertFalse($access_control_handler
->createAccess('test', $account));
$account = $this
->createUser([], [
'update any commerce_promotion',
]);
$this
->assertTrue($access_control_handler
->createAccess('test', $account));
$account = $this
->createUser([], [
'administer commerce_promotion',
]);
$this
->assertTrue($access_control_handler
->createAccess('test', $account));
}