View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\Core\Entity\EntityViewModeInterface;
class ViewModesTest extends Ubercart6TestBase {
public static $modules = [
'commerce_price',
'commerce_product',
'commerce_store',
'menu_ui',
'migrate_plus',
'node',
'path',
];
protected function setUp() {
parent::setUp();
$this
->migrateStore();
$this
->migrateFields();
}
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('node.teaser', 'Teaser', 'node');
$this
->assertEntity('node.full', 'Full content', 'node');
$this
->assertEntity('node.rss', 'RSS', 'node');
$this
->assertEntity('commerce_product.teaser', 'Teaser', 'commerce_product');
$this
->assertEntity('commerce_product.full', 'Full', 'commerce_product');
$this
->assertEntity('commerce_product.rss', 'RSS', 'commerce_product');
}
}