Same name in other branches
- 2.x tests/src/Functional/EntityCloneContentTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneContentTest::testContentEntityClone()
Test content entity clone.
File
-
tests/
src/ Functional/ EntityCloneContentTest.php, line 77
Class
- EntityCloneContentTest
- Create a content and test a clone.
Namespace
Drupal\Tests\entity_clone\FunctionalCode
public function testContentEntityClone() {
$node_title = $this->randomMachineName(8);
$node = Node::create([
'type' => 'page',
'title' => $node_title,
]);
$node->save();
$this->drupalGet('entity_clone/node/' . $node->id());
$this->submitForm([], $this->t('Clone'));
$nodes = \Drupal::entityTypeManager()->getStorage('node')
->loadByProperties([
'title' => $node_title . ' - Cloned',
]);
$node = reset($nodes);
$this->assertInstanceOf(Node::class, $node, 'Test node cloned found in database.');
}