MigrateBlockContentEntityDisplayTest.php in Drupal 9
File
core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php
View source
<?php
namespace Drupal\Tests\block_content\Kernel\Migrate;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateBlockContentEntityDisplayTest extends MigrateDrupal7TestBase {
protected static $modules = [
'block',
'block_content',
'filter',
'text',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('block_content');
$this
->installConfig(static::$modules);
$this
->executeMigrations([
'block_content_type',
'block_content_body_field',
'block_content_entity_display',
]);
}
protected function assertDisplay($id, $component_id) {
$component = EntityViewDisplay::load($id)
->getComponent($component_id);
$this
->assertIsArray($component);
$this
->assertSame('hidden', $component['label']);
}
public function testMigration() {
$this
->assertDisplay('block_content.basic.default', 'body');
}
}