function RollbackViewModesTest::testMigration

Same name in other branches
  1. 8.9.x core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\RollbackViewModesTest::testMigration()
  2. 10 core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\RollbackViewModesTest::testMigration()
  3. 11.x core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\RollbackViewModesTest::testMigration()

Tests migrating D7 view modes, then rolling back.

Overrides MigrateViewModesTest::testMigration

File

core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php, line 23

Class

RollbackViewModesTest
Migrates and rolls back Drupal 7 view modes.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

public function testMigration() {
    // Test that the view modes have migrated (prior to rollback).
    parent::testMigration();
    $this->executeRollback('d7_view_modes');
    // Check that view modes have been rolled back.
    $view_mode_ids = [
        'comment.full',
        'node.teaser',
        'node.full',
        'user.full',
    ];
    foreach ($view_mode_ids as $view_mode_id) {
        $this->assertNull(EntityViewMode::load($view_mode_id));
    }
}

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