You are here

protected function AcquiadamMediaTest::setUp in Media: Acquia DAM 8

Overrides AcquiadamKernelTestBase::setUp

File

tests/src/Kernel/AcquiadamMediaTest.php, line 48

Class

AcquiadamMediaTest
Tests Media entities with Media: Acquia DAM source.

Namespace

Drupal\Tests\media_acquiadam\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this->sourceReflectionClass = new \ReflectionClass(AcquiadamAsset::class);
  $this->acquiadamReflectionClass = new \ReflectionClass(Acquiadam::class);
  $this->asset = $this
    ->getAssetData();

  // Create file with same name as asset file to make sure asset file
  // replacement happens as expected.
  $dir_path = 'public://acquiadam/';
  $contents = 'test';
  $this->container
    ->get('file_system')
    ->prepareDirectory($dir_path, FileSystemInterface::CREATE_DIRECTORY);
  file_save_data($contents, $dir_path . $this->asset->filename);
  $this->testClient
    ->addAsset($this->asset);
  $this->media = $this
    ->createMedia($this->asset->id);
}