class MigrateViewModesTest

Same name in this branch
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest
Same name and namespace in other branches
  1. 11.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest
  2. 11.x core/modules/node/tests/src/Kernel/Migrate/d6/MigrateViewModesTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateViewModesTest

Migrate view modes.

@group migrate_drupal_6

Hierarchy

Expanded class hierarchy of MigrateViewModesTest

File

core/modules/node/tests/src/Kernel/Migrate/d6/MigrateViewModesTest.php, line 13

Namespace

Drupal\Tests\node\Kernel\Migrate\d6
View source
class MigrateViewModesTest extends MigrateDrupal6TestBase {
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->executeMigration('d6_view_modes');
  }
  
  /**
   * Tests Drupal 6 view modes to Drupal 8 migration.
   */
  public function testViewModes() {
    // Test a new view mode.
    $view_mode = EntityViewMode::load('node.preview');
    $this->assertNotNull($view_mode);
    $this->assertSame('Preview', $view_mode->label(), 'View mode has correct label.');
    // Test the ID map.
    $this->assertSame([
      [
        'node',
        'preview',
      ],
    ], $this->getMigration('d6_view_modes')
      ->getIdMap()
      ->lookupDestinationIds([
      1,
    ]));
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.