bf5807e68e5809eec62116f54efd5555f69972ce
[yaffs-website] / web / core / modules / file / tests / src / Kernel / Migrate / d6 / MigrateUploadInstanceTest.php
1 <?php
2
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  * Upload field instance migration.
10  *
11  * @group migrate_drupal_6
12  */
13 class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['menu_ui'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->migrateFields();
26   }
27
28   /**
29    * Tests the Drupal 6 upload settings to Drupal 8 field instance migration.
30    */
31   public function testUploadFieldInstance() {
32     $field = FieldConfig::load('node.page.upload');
33     $settings = $field->getSettings();
34     $this->assertIdentical('node.page.upload', $field->id());
35     $this->assertIdentical('jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp', $settings['file_extensions']);
36     $this->assertIdentical('1MB', $settings['max_filesize']);
37     $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     $this->assertTrue(is_null($field));
45
46     $this->assertIdentical(['node', 'page', 'upload'], $this->getMigration('d6_upload_field_instance')->getIdMap()->lookupDestinationId(['page']));
47   }
48
49 }