MigrateUploadInstanceTest.php 1.39 KB
Newer Older
1
2
3
4
<?php

/**
 * @file
5
 * Contains \Drupal\file\Tests\Migrate\d6\MigrateUploadInstanceTest.
6
7
 */

8
namespace Drupal\file\Tests\Migrate\d6;
9

10
use Drupal\field\Entity\FieldConfig;
11
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
12
13

/**
14
15
 * Upload field instance migration.
 *
16
 * @group migrate_drupal_6
17
 */
18
class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
19
20
21
22
23
24

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
25
    $this->migrateFields();
26
27
28
29
30
31
  }

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

39
    $field = FieldConfig::load('node.story.upload');
40
    $this->assertIdentical('node.story.upload', $field->id());
41
42

    // Shouldn't exist.
43
    $field = FieldConfig::load('node.article.upload');
44
45
    $this->assertTrue(is_null($field));

46
    $this->assertIdentical(array('node', 'page', 'upload'), $this->getMigration('d6_upload_field_instance')->getIdMap()->lookupDestinationID(array('page')));
47
48
49
  }

}