public function OrderItemAccessTest::testCreateAccess in Commerce Core 8.2
@covers ::checkCreateAccess
File
- modules/
order/ tests/ src/ Kernel/ OrderItemAccessTest.php, line 95
Class
- OrderItemAccessTest
- Tests the order item access control.
Namespace
Drupal\Tests\commerce_order\KernelCode
public function testCreateAccess() {
$access_control_handler = \Drupal::entityTypeManager()
->getAccessControlHandler('commerce_order_item');
$account = $this
->createUser([], [
'access content',
]);
$this
->assertFalse($access_control_handler
->createAccess('test', $account));
$account = $this
->createUser([], [
'administer commerce_order',
]);
$this
->assertTrue($access_control_handler
->createAccess('test', $account));
$account = $this
->createUser([], [
'manage test commerce_order_item',
]);
$this
->assertTrue($access_control_handler
->createAccess('test', $account));
}