MigrateNodeTitleLabelTest.php in Drupal 9
File
core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php
View source
<?php
namespace Drupal\Tests\node\Kernel\Migrate\d7;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateNodeTitleLabelTest extends MigrateDrupal7TestBase {
protected static $modules = [
'node',
'text',
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->migrateContentTypes();
$this
->executeMigration('d7_node_title_label');
}
protected function assertEntity($id, $label) {
$override = BaseFieldOverride::load($id);
$this
->assertInstanceOf(BaseFieldOverride::class, $override);
$this
->assertSame($label, $override
->getLabel());
}
public function testMigration() {
$this
->assertEntity('node.forum.title', 'Subject');
$no_override_node_type = [
'article',
'blog',
'book',
'page',
'test_content_type',
];
foreach ($no_override_node_type as $type) {
$override = BaseFieldOverride::load("node.{$type}.title");
$this
->assertNotInstanceOf(BaseFieldOverride::class, $override);
}
}
}