You are here

protected function EntityFileTest::localFileDataProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/Migrate/EntityFileTest.php \Drupal\file\Tests\Migrate\EntityFileTest::localFileDataProvider()

The data provider for testing the file destination.

Return value

array An array of file permutations to test.

1 call to EntityFileTest::localFileDataProvider()
EntityFileTest::testSuccessfulCopies in core/modules/file/src/Tests/Migrate/EntityFileTest.php
Test successful imports/copies.

File

core/modules/file/src/Tests/Migrate/EntityFileTest.php, line 69
Contains \Drupal\file\Tests\Migrate\EntityFileTest.

Class

EntityFileTest
Tests the entity file destination plugin.

Namespace

Drupal\file\Tests\Migrate

Code

protected function localFileDataProvider() {
  global $base_url;
  return [
    // Test a local to local copy.
    [
      [
        'filepath' => 'core/modules/simpletest/files/image-test.jpg',
      ],
      'public://file1.jpg',
      TRUE,
      DRUPAL_ROOT . '/',
    ],
    // Test a temporary file using an absolute path.
    [
      [
        'filepath' => '/tmp/test-file.jpg',
      ],
      'temporary://test.jpg',
      TRUE,
      '',
    ],
    // Test a temporary file using a relative path.
    [
      [
        'filepath' => 'test-file.jpg',
      ],
      'temporary://core/modules/simpletest/files/test.jpg',
      TRUE,
      '/tmp/',
    ],
    // Test a remote path to local.
    [
      [
        'filepath' => 'core/modules/simpletest/files/image-test.jpg',
      ],
      'public://remote-file.jpg',
      TRUE,
      $base_url . '/',
    ],
    // Test a remote path to local inside a folder that doesn't exist.
    [
      [
        'filepath' => 'core/modules/simpletest/files/image-test.jpg',
      ],
      'public://folder/remote-file.jpg',
      TRUE,
      DRUPAL_ROOT . '/',
    ],
  ];
}