You are here

protected function MigrateMediaTestBase::setUp in Media Migration 8

Overrides MigrateUpgradeTestBase::setUp

File

tests/src/Functional/MigrateMediaTestBase.php, line 414

Class

MigrateMediaTestBase
Provides a base class for testing media migration via the UI.

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->destinationSiteVersion = explode('.', \Drupal::VERSION, 2)[0];

  // Delete 'article' content type. The destination Drupal 8|9 instance's
  // article content type will contain an image type field with the same name
  // that we have in the source Drupal 7 database. Media Migration tries to
  // change the field type of file and image fields to media reference, but
  // since the type of an existing field cannot be changed, this is the only
  // way to test the migration of media until we solve this issue.
  if ($node_type_storage = $this
    ->getEntityStorage('node_type')) {
    if ($article_node_type = $node_type_storage
      ->load('article')) {
      $article_node_type
        ->delete();
    }
  }
  $this
    ->loadFixture($this
    ->getFixtureFilePath());
  $this
    ->setEmbedTokenDestinationFilterPlugin($this->embedTokenDestinationFilterPlugin);
  $this
    ->setEmbedMediaReferenceMethod($this->embedMediaReferenceMethod);
}