3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Tests the migration of comment form's subject display from Drupal 6.
12 * @group migrate_drupal_6
14 class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal6TestBase {
19 public static $modules = ['comment'];
24 protected function setUp() {
26 $this->installConfig(['comment']);
27 $this->executeMigrations([
29 'd6_comment_entity_form_display_subject',
34 * Asserts that the comment subject field is visible for a node type.
37 * The entity form display ID.
39 protected function assertSubjectVisible($id) {
40 $component = EntityFormDisplay::load($id)->getComponent('subject');
41 $this->assertInternalType('array', $component);
42 $this->assertSame('string_textfield', $component['type']);
43 $this->assertSame(10, $component['weight']);
47 * Asserts that the comment subject field is not visible for a node type.
50 * The entity form display ID.
52 protected function assertSubjectNotVisible($id) {
53 $component = EntityFormDisplay::load($id)->getComponent('subject');
54 $this->assertNull($component);
58 * Tests the migrated display configuration.
60 public function testMigration() {
61 $this->assertSubjectVisible('comment.comment_node_article.default');
62 $this->assertSubjectVisible('comment.comment_node_company.default');
63 $this->assertSubjectVisible('comment.comment_node_employee.default');
64 $this->assertSubjectVisible('comment.comment_node_page.default');
65 $this->assertSubjectVisible('comment.comment_node_sponsor.default');
66 $this->assertSubjectNotVisible('comment.comment_node_story.default');
67 $this->assertSubjectVisible('comment.comment_node_test_event.default');
68 $this->assertSubjectVisible('comment.comment_node_test_page.default');
69 $this->assertSubjectVisible('comment.comment_node_test_planet.default');
70 $this->assertSubjectVisible('comment.comment_node_test_story.default');