protected function RoleGrantedLockingTest::setUp in Commerce License 8.2
Overrides CommerceBrowserTestBase::setUp
File
- tests/
src/ Functional/ RoleGrantedLockingTest.php, line 43
Class
- RoleGrantedLockingTest
- Tests that a role granted by a license can't be removed in the user form.
Namespace
Drupal\Tests\commerce_license\FunctionalCode
protected function setUp() : void {
parent::setUp();
$license_owner = $this
->createUser();
$role = $this
->createEntity('user_role', [
'id' => 'licensed_role',
'label' => 'Licensed role',
]);
// Create a license in the 'active' state.
$license = $this
->createEntity('commerce_license', [
'type' => 'role',
'state' => 'active',
'product_variation' => 1,
'uid' => $license_owner
->id(),
// Use the unlimited expiry plugin as it's simple.
'expiration_type' => [
'target_plugin_id' => 'unlimited',
'target_plugin_configuration' => [],
],
'license_role' => $role,
]);
$this->license = $this
->reloadEntity($license);
}