Version 1
[yaffs-website] / web / core / modules / node / tests / src / Kernel / Migrate / d6 / MigrateViewModesTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Kernel\Migrate\d6;
4
5 use Drupal\Core\Entity\Entity\EntityViewMode;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Migrate view modes.
10  *
11  * @group migrate_drupal_6
12  */
13 class MigrateViewModesTest extends MigrateDrupal6TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   protected function setUp() {
19     parent::setUp();
20     $this->executeMigration('d6_view_modes');
21   }
22
23   /**
24    * Tests Drupal 6 view modes to Drupal 8 migration.
25    */
26   public function testViewModes() {
27     // Test a new view mode.
28     $view_mode = EntityViewMode::load('node.preview');
29     $this->assertIdentical(FALSE, is_null($view_mode), 'Preview view mode loaded.');
30     $this->assertIdentical('Preview', $view_mode->label(), 'View mode has correct label.');
31     // Test the ID map.
32     $this->assertIdentical(['node', 'preview'], $this->getMigration('d6_view_modes')->getIdMap()->lookupDestinationID([1]));
33   }
34
35 }