AjaxCommentsSettingsFormTest.php in AJAX Comments 8
File
src/Tests/AjaxCommentsSettingsFormTest.php
View source
<?php
namespace Drupal\ajax_comments\Tests;
use Drupal\Tests\comment\Functional\CommentTestBase;
use Drupal\user\Entity\Role;
class AjaxCommentsSettingsFormTest extends CommentTestBase {
public static $modules = [
'system',
'block',
'comment',
'node',
'ajax_comments',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$admin_roles = $this->adminUser
->getRoles();
$admin_role = Role::load(reset($admin_roles));
$this
->grantPermissions($admin_role, [
'administer site configuration',
'administer node display',
]);
}
public function testAjaxCommentsSettings() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/content/ajax_comments');
$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);
$this
->drupalPostForm(NULL, [], 'comment_settings_edit');
$this
->drupalPostForm(NULL, [
'fields[comment][settings_edit_form][third_party_settings][ajax_comments][enable_ajax_comments]' => '0',
], 'comment_plugin_settings_update');
$this
->drupalPostForm(NULL, [], t('Save'));
$this
->assertResponse(200);
}
}