public function NodeFormTest::testNodeForm in Acquia Content Hub 8
Configure content hub node form.
File
- tests/
src/ Functional/ NodeFormTest.php, line 27
Class
- NodeFormTest
- Test Acquia Content Hub node form.
Namespace
Drupal\Tests\acquia_contenthub\FunctionalCode
public function testNodeForm() {
$this
->drupalLogin($this->adminUser);
$this->article = $this
->drupalCreateNode([
'type' => 'article',
]);
// A normal node should not have Acquia Content Hub settings.
$this
->drupalGet('node/' . $this->article
->id() . '/edit');
$this
->assertSession()
->pageTextNotContains($this
->t('Acquia Content Hub settings'));
// 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()
->pageTextContains($this
->t('Acquia Content Hub settings'));
$this
->assertSession()
->checkboxChecked('edit-acquia-contenthub-auto-update');
// Disable automatic update.
$edit = [];
$edit['acquia_contenthub[auto_update]'] = FALSE;
$this
->submitForm($edit, $this
->t('Save'));
// Option should now set to "disabled".
$this
->drupalGet($node_edit_url);
$this
->assertSession()
->checkboxNotChecked('edit-acquia-contenthub-auto-update');
}