You are here

protected function LicenseFileManagerTest::setUp in Commerce File 8.2

Overrides CommerceFileKernelTestBase::setUp

File

tests/src/Kernel/LicenseFileManagerTest.php, line 41

Class

LicenseFileManagerTest
Tests the license file manager.

Namespace

Drupal\Tests\commerce_file\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $test_user = $this
    ->createUser([
    'mail' => $this
      ->randomString() . '@example.com',
  ], [
    'view own commerce_license',
  ]);
  $license = License::create([
    'type' => 'commerce_file',
    'state' => 'active',
    'uid' => $test_user
      ->id(),
    'product_variation' => $this->variation,
    'expiration_type' => [
      'target_plugin_id' => 'unlimited',
      'target_plugin_configuration' => [],
    ],
    'file_download_limit' => 2,
  ]);
  $license
    ->save();
  $this->license = $this
    ->reloadEntity($license);
  $this->licenseFileManager = $this->container
    ->get('commerce_file.license_file_manager');
}