function CommentEntityReferenceTest::testCommentAsEntityReference
Same name in other branches
- 11.x core/modules/comment/tests/src/Functional/CommentEntityReferenceTest.php \Drupal\Tests\comment\Functional\CommentEntityReferenceTest::testCommentAsEntityReference()
Tests that comments are correctly saved as entity references.
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentEntityReferenceTest.php, line 86
Class
- CommentEntityReferenceTest
- Tests that comments behave correctly when added as entity references.
Namespace
Drupal\Tests\comment\FunctionalCode
public function testCommentAsEntityReference() : void {
// Load the node and save it.
$edit = [
'entity_reference_comment' => $this->comment
->id(),
];
$this->drupalGet('node/' . $this->node2
->id() . '/edit');
$this->submitForm($edit, 'Save');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains('has been updated');
// Make sure the comment is linked.
$this->assertSession()
->pageTextContains($this->comment
->label());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.