You are here

public function MigrateUploadInstanceTest::testUploadFieldInstance in Zircon Profile 8

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

Tests the Drupal 6 upload settings to Drupal 8 field instance migration.

File

core/modules/file/src/Tests/Migrate/d6/MigrateUploadInstanceTest.php, line 32
Contains \Drupal\file\Tests\Migrate\d6\MigrateUploadInstanceTest.

Class

MigrateUploadInstanceTest
Upload field instance migration.

Namespace

Drupal\file\Tests\Migrate\d6

Code

public function testUploadFieldInstance() {
  $field = FieldConfig::load('node.page.upload');
  $settings = $field
    ->getSettings();
  $this
    ->assertIdentical('node.page.upload', $field
    ->id());
  $this
    ->assertIdentical('jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp', $settings['file_extensions']);
  $this
    ->assertIdentical('1MB', $settings['max_filesize']);
  $this
    ->assertIdentical(TRUE, $settings['description_field']);
  $field = FieldConfig::load('node.story.upload');
  $this
    ->assertIdentical('node.story.upload', $field
    ->id());

  // Shouldn't exist.
  $field = FieldConfig::load('node.article.upload');
  $this
    ->assertTrue(is_null($field));
  $this
    ->assertIdentical(array(
    'node',
    'page',
    'upload',
  ), Migration::load('d6_upload_field_instance')
    ->getIdMap()
    ->lookupDestinationID(array(
    'page',
  )));
}