protected function LicenseAdminTest::setUp in Commerce License 8.2
Overrides CommerceWebDriverTestBase::setUp
File
- tests/
src/ FunctionalJavascript/ LicenseAdminTest.php, line 47
Class
- LicenseAdminTest
- Tests the admin UI for licenses.
Namespace
Drupal\Tests\commerce_license\FunctionalJavascriptCode
protected function setUp() : void {
parent::setUp();
$trait_manager = \Drupal::service('plugin.manager.commerce_entity_trait');
$this
->createEntity('commerce_product_variation_type', [
'id' => 'license_pv_type',
'label' => $this
->randomMachineName(),
'orderItemType' => 'default',
'traits' => [
'commerce_license',
],
]);
$trait = $trait_manager
->createInstance('commerce_license');
$trait_manager
->installTrait($trait, 'commerce_product_variation', 'license_pv_type');
$roles = $this->adminUser
->getRoles(TRUE);
$this->variation = $this
->createEntity('commerce_product_variation', [
'type' => 'license_pv_type',
'sku' => $this
->randomMachineName(),
'price' => [
'number' => 5.55,
'currency_code' => 'USD',
],
'license_type' => [
'target_plugin_id' => 'role',
'target_plugin_configuration' => [
'license_role' => reset($roles),
],
],
]);
}