MigrateCommentEntityFormDisplaySubjectTest.php in Drupal 10
File
core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplaySubjectTest.php
View source
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal6TestBase {
protected static $modules = [
'comment',
];
protected function setUp() : void {
parent::setUp();
$this
->installConfig([
'comment',
]);
$this
->executeMigrations([
'd6_comment_type',
'd6_comment_entity_form_display_subject',
]);
}
protected function assertSubjectVisible(string $id) : void {
$component = EntityFormDisplay::load($id)
->getComponent('subject');
$this
->assertIsArray($component);
$this
->assertSame('string_textfield', $component['type']);
$this
->assertSame(10, $component['weight']);
}
protected function assertSubjectNotVisible(string $id) : void {
$component = EntityFormDisplay::load($id)
->getComponent('subject');
$this
->assertNull($component);
}
public function testMigration() {
$this
->assertSubjectVisible('comment.comment_node_article.default');
$this
->assertSubjectVisible('comment.comment_node_company.default');
$this
->assertSubjectVisible('comment.comment_node_employee.default');
$this
->assertSubjectVisible('comment.comment_node_page.default');
$this
->assertSubjectVisible('comment.comment_node_sponsor.default');
$this
->assertSubjectNotVisible('comment.comment_node_story.default');
$this
->assertSubjectVisible('comment.comment_node_test_event.default');
$this
->assertSubjectVisible('comment.comment_node_test_page.default');
$this
->assertSubjectVisible('comment.comment_node_test_planet.default');
$this
->assertSubjectVisible('comment.comment_node_test_story.default');
}
}