MigrateViewModesTest.php in Zircon Profile 8
File
core/modules/field/src/Tests/Migrate/d7/MigrateViewModesTest.php
View source
<?php
namespace Drupal\field\Tests\Migrate\d7;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\Core\Entity\EntityViewModeInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
class MigrateViewModesTest extends MigrateDrupal7TestBase {
public static $modules = [
'comment',
'node',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('comment');
$this
->installEntitySchema('node');
$this
->executeMigration('d7_view_modes');
}
protected function assertEntity($id, $label, $entity_type) {
$view_mode = EntityViewMode::load($id);
$this
->assertTrue($view_mode instanceof EntityViewModeInterface);
$this
->assertIdentical($label, $view_mode
->label());
$this
->assertIdentical($entity_type, $view_mode
->getTargetType());
}
public function testMigration() {
$this
->assertEntity('comment.full', 'Full', 'comment');
$this
->assertEntity('node.teaser', 'Teaser', 'node');
$this
->assertEntity('node.full', 'Full', 'node');
$this
->assertEntity('user.full', 'Full', 'user');
}
}