3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
5 use Drupal\comment\CommentManagerInterface;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7 use Drupal\node\Entity\Node;
10 * Upgrade comment variables to field.instance.node.*.comment.yml.
12 * @group migrate_drupal_6
14 class MigrateCommentVariableInstanceTest extends MigrateDrupal6TestBase {
19 public static $modules = ['comment', 'menu_ui'];
24 protected function setUp() {
26 $this->installConfig(['comment']);
27 $this->migrateContentTypes();
28 $this->executeMigrations([
31 'd6_comment_field_instance',
36 * Test the migrated field instance values.
38 public function testCommentFieldInstance() {
39 $node = Node::create(['type' => 'page']);
40 $this->assertIdentical(0, $node->comment->status);
41 $this->assertIdentical('comment', $node->comment->getFieldDefinition()->getName());
42 $settings = $node->comment->getFieldDefinition()->getSettings();
43 $this->assertIdentical(CommentManagerInterface::COMMENT_MODE_THREADED, $settings['default_mode']);
44 $this->assertIdentical(50, $settings['per_page']);
45 $this->assertFalse($settings['anonymous']);
46 $this->assertFalse($settings['form_location']);
47 $this->assertTrue($settings['preview']);
49 $node = Node::create(['type' => 'story']);
50 $this->assertIdentical(2, $node->comment_no_subject->status);
51 $this->assertIdentical('comment_no_subject', $node->comment_no_subject->getFieldDefinition()->getName());
52 $settings = $node->comment_no_subject->getFieldDefinition()->getSettings();
53 $this->assertIdentical(CommentManagerInterface::COMMENT_MODE_FLAT, $settings['default_mode']);
54 $this->assertIdentical(70, $settings['per_page']);
55 $this->assertTrue($settings['anonymous']);
56 $this->assertFalse($settings['form_location']);
57 $this->assertFalse($settings['preview']);