MigrateUploadInstanceTest.php 1.31 KB
Newer Older
1
2
<?php

3
namespace Drupal\Tests\file\Kernel\Migrate\d6;
4

5
use Drupal\field\Entity\FieldConfig;
6
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8

/**
9
10
 * Upload field instance migration.
 *
11
 * @group migrate_drupal_6
12
 */
13
class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
14
15
16
17
18
19

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
20
    $this->migrateFields();
21
22
23
24
25
26
  }

  /**
   * Tests the Drupal 6 upload settings to Drupal 8 field instance migration.
   */
  public function testUploadFieldInstance() {
27
    $field = FieldConfig::load('node.page.upload');
28
    $settings = $field->getSettings();
29
30
31
32
    $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']);
33

34
    $field = FieldConfig::load('node.story.upload');
35
    $this->assertIdentical('node.story.upload', $field->id());
36
37

    // Shouldn't exist.
38
    $field = FieldConfig::load('node.article.upload');
39
40
    $this->assertTrue(is_null($field));

41
    $this->assertIdentical(['node', 'page', 'upload'], $this->getMigration('d6_upload_field_instance')->getIdMap()->lookupDestinationID(['page']));
42
43
44
  }

}