Same name in other branches
- 2.x tests/src/Functional/EntityCloneCommentTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneCommentTest::testCommentEntityClone()
Test comment entity clone.
Fichier
-
tests/
src/ Functional/ EntityCloneCommentTest.php, line 74
Classe
- EntityCloneCommentTest
- Create a comment and test a clone.
Namespace
Drupal\Tests\entity_clone\FunctionalCode
public function testCommentEntityClone() {
$subject = 'Test comment for clone';
$body = $this->randomMachineName();
$comment = $this->postComment($this->node, $body, $subject, TRUE);
$this->drupalGet('entity_clone/comment/' . $comment->id());
$this->submitForm([], $this->t('Clone'));
$comments = \Drupal::entityTypeManager()->getStorage('comment')
->loadByProperties([
'subject' => $subject . ' - Cloned',
'comment_body' => $body,
]);
$comments = reset($comments);
$this->assertInstanceOf(Comment::class, $comments, 'Test comment cloned found in database.');
}