public function MigrateCommentVariableInstanceTest::testCommentFieldInstance in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/Migrate/d6/MigrateCommentVariableInstanceTest.php \Drupal\comment\Tests\Migrate\d6\MigrateCommentVariableInstanceTest::testCommentFieldInstance()
Test the migrated field instance values.
File
- core/
modules/ comment/ src/ Tests/ Migrate/ d6/ MigrateCommentVariableInstanceTest.php, line 43 - Contains \Drupal\comment\Tests\Migrate\d6\MigrateCommentVariableInstanceTest.
Class
- MigrateCommentVariableInstanceTest
- Upgrade comment variables to field.instance.node.*.comment.yml.
Namespace
Drupal\comment\Tests\Migrate\d6Code
public function testCommentFieldInstance() {
$node = Node::create([
'type' => 'page',
]);
$this
->assertIdentical(0, $node->comment->status);
$this
->assertIdentical('comment', $node->comment
->getFieldDefinition()
->getName());
$settings = $node->comment
->getFieldDefinition()
->getSettings();
$this
->assertIdentical(CommentManagerInterface::COMMENT_MODE_THREADED, $settings['default_mode']);
$this
->assertIdentical(50, $settings['per_page']);
$this
->assertFalse($settings['anonymous']);
$this
->assertFalse($settings['form_location']);
$this
->assertTrue($settings['preview']);
$node = Node::create([
'type' => 'story',
]);
$this
->assertIdentical(2, $node->comment_no_subject->status);
$this
->assertIdentical('comment_no_subject', $node->comment_no_subject
->getFieldDefinition()
->getName());
$settings = $node->comment_no_subject
->getFieldDefinition()
->getSettings();
$this
->assertIdentical(CommentManagerInterface::COMMENT_MODE_FLAT, $settings['default_mode']);
$this
->assertIdentical(70, $settings['per_page']);
$this
->assertTrue($settings['anonymous']);
$this
->assertFalse($settings['form_location']);
$this
->assertFalse($settings['preview']);
}