public function QuickNodeCloneExcludeNodeFieldsTest::testNodeCloneExcludeNodeFields in Quick Node Clone 8
Test node clone excluding fields.
File
- tests/
src/ Functional/ QuickNodeCloneExcludeNodeFieldsTest.php, line 59
Class
- QuickNodeCloneExcludeNodeFieldsTest
- Tests node cloning excluding node fields.
Namespace
Drupal\Tests\quick_node_clone\FunctionalCode
public function testNodeCloneExcludeNodeFields() {
$this
->drupalLogin($this->adminUser);
// Test the form.
$edit = [
'text_to_prepend_to_title' => 'Cloned from',
'bundle_names[page]' => TRUE,
'page[body]' => TRUE,
];
$this
->drupalGet('admin/config/quick-node-clone');
$this
->submitForm($edit, 'Save');
// Create a basic page.
$title_value = $this->randomGenerator
->word(10);
$body_value = $this->randomGenerator
->sentences(10);
$edit = [
'title[0][value]' => $title_value,
'body[0][value]' => $body_value,
];
$this
->drupalGet('node/add/page');
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->responseContains($title_value);
$this
->assertSession()
->responseContains($body_value);
// Clone node.
$this
->clickLink('Clone');
$node = $this
->getNodeByTitle($title_value);
$this
->drupalGet('clone/' . $node
->id() . '/quick_clone');
$this
->submitForm([], 'Save');
$this
->assertSession()
->responseContains('Cloned from ' . $title_value);
$this
->assertSession()
->responseNotContains($body_value);
}