View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\Core\Entity\EntityViewModeInterface;
class ViewModesTest extends Ubercart7TestBase {
public static $modules = [
'comment',
'commerce_price',
'commerce_product',
'commerce_store',
'image',
'node',
'taxonomy',
'text',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('commerce_store');
$this
->installConfig([
'node',
]);
$this
->executeMigration('d7_view_modes');
}
protected function assertEntity($id, $label, $entity_type) {
$view_mode = EntityViewMode::load($id);
$this
->assertInstanceOf(EntityViewModeInterface::class, $view_mode);
$this
->assertSame($label, $view_mode
->label());
$this
->assertSame($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('commerce_product.full', 'Full', 'commerce_product');
$this
->assertEntity('commerce_product.teaser', 'Teaser', 'commerce_product');
$this
->assertEntity('taxonomy_term.full', 'Full', 'taxonomy_term');
}
}