public function NodeFormTest::testNodeFormIntroduceLocalChange in Acquia Content Hub 8
Configure content hub node form, auto setting to "having local change".
File
- tests/
src/ Functional/ NodeFormTest.php, line 58
Class
- NodeFormTest
- Test Acquia Content Hub node form.
Namespace
Drupal\Tests\acquia_contenthub\FunctionalCode
public function testNodeFormIntroduceLocalChange() {
$this
->drupalLogin($this->adminUser);
$this->article = $this
->drupalCreateNode([
'type' => 'article',
]);
// Convert the node into a Content Hub node.
$this
->convertToContentHubEntity($this->article);
// A Content Hub node should have Acquia Content Hub settings.
// Form should have option, and default to "enabled".
$node_edit_url = 'node/' . $this->article
->id() . '/edit';
$this
->drupalGet($node_edit_url);
$this
->assertSession()
->pageTextNotContains($this
->t('This syndicated content has been modified locally, therefore it is no longer automatically synchronized to its original content.'));
$this
->assertSession()
->checkboxChecked('edit-acquia-contenthub-auto-update');
// Don't edit anything, save.
$this
->submitForm([], $this
->t('Save'));
// Option should still be set to "enabled".
$this
->drupalGet($node_edit_url);
$this
->assertSession()
->pageTextNotContains($this
->t('This syndicated content has been modified locally, therefore it is no longer automatically synchronized to its original content.'));
$this
->assertSession()
->checkboxChecked('edit-acquia-contenthub-auto-update');
// Edit title.
$edit = [];
$edit['title[0][value]'] = 'my new title';
$this
->submitForm($edit, $this
->t('Save'));
// Option should now set to "disabled, as having local changes".
$this
->drupalGet($node_edit_url);
$this
->assertSession()
->pageTextContains($this
->t('This syndicated content has been modified locally, therefore it is no longer automatically synchronized to its original content.'));
$this
->assertSession()
->checkboxNotChecked('edit-acquia-contenthub-auto-update');
}