You are here

public function AjaxCommentsSettingsFormTest::testAjaxCommentsSettings in AJAX Comments 8

Test the \Drupal\ajax_comments\Form\SettingsForm.

File

src/Tests/AjaxCommentsSettingsFormTest.php, line 46

Class

AjaxCommentsSettingsFormTest
Tests the \Drupal\ajax_comments\Form\SettingsForm.

Namespace

Drupal\ajax_comments\Tests

Code

public function testAjaxCommentsSettings() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/content/ajax_comments');

  // Check that the page loads.
  $this
    ->assertResponse(200);
  $this
    ->assertText(t("Enable Ajax Comments on the comment fields' display settings"), 'The list of bundles appears on the form.');
  $this
    ->clickLink(t('Content: Article'));
  $this
    ->assertUrl('/admin/structure/types/manage/article/display', [], 'There is a link to the entity view display form for articles.');
  $this
    ->assertResponse(200);

  // Open comment settings.
  $this
    ->drupalPostForm(NULL, [], 'comment_settings_edit');

  // Disable ajax comments.
  $this
    ->drupalPostForm(NULL, [
    'fields[comment][settings_edit_form][third_party_settings][ajax_comments][enable_ajax_comments]' => '0',
  ], 'comment_plugin_settings_update');

  // Save display mode.
  $this
    ->drupalPostForm(NULL, [], t('Save'));
  $this
    ->assertResponse(200);
}