You are here

protected function CsvTestBase::fileMigrationSetup in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x tests/src/Kernel/CsvTestBase.php \Drupal\Tests\commerce_migrate\Kernel\CsvTestBase::fileMigrationSetup()
  2. 3.0.x tests/src/Kernel/CsvTestBase.php \Drupal\Tests\commerce_migrate\Kernel\CsvTestBase::fileMigrationSetup()

Prepares a public file directory for the migration.

Enables file module and recursively copies the source directory to the migration source path.

Parameters

string $source_directory: The source file directory.

3 calls to CsvTestBase::fileMigrationSetup()
ImageTest::setUp in modules/csv_example/tests/src/Kernel/Migrate/ImageTest.php
ImageTest::setUp in modules/magento/tests/src/Kernel/Migrate/magento2/ImageTest.php
ProductVariationTest::setUp in modules/csv_example/tests/src/Kernel/Migrate/ProductVariationTest.php

File

tests/src/Kernel/CsvTestBase.php, line 181

Class

CsvTestBase
Test base for migrations tests with CSV source file.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

protected function fileMigrationSetup($source_directory) {
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  $this
    ->installEntitySchema('file');
  $this->container
    ->get('stream_wrapper_manager')
    ->registerWrapper('public', PublicStream::class, StreamWrapperInterface::NORMAL);

  // Copy the file source directory to the public directory.
  $destination = $this->csvPath . '/images';
  $this
    ->recurseCopy($source_directory, $destination);
}