X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FRollbackViewModesTest.php;fp=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FRollbackViewModesTest.php;h=b069387cfc6a8caefef56c34b5bb25bb54a361f8;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php b/web/core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php new file mode 100644 index 000000000..b069387cf --- /dev/null +++ b/web/core/modules/field/tests/src/Kernel/Migrate/d7/RollbackViewModesTest.php @@ -0,0 +1,52 @@ +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)); + } + } + + /** + * Executes a single rollback. + * + * @param string|\Drupal\migrate\Plugin\MigrationInterface $migration + * The migration to rollback, or its ID. + */ + protected function executeRollback($migration) { + if (is_string($migration)) { + $this->migration = $this->getMigration($migration); + } + else { + $this->migration = $migration; + } + (new MigrateExecutable($this->migration, $this))->rollback(); + } + +}