AnonymousPublishingAdminSettingsTest.php in Anonymous Publishing 8
File
modules/anonymous_publishing_cl/src/Tests/AnonymousPublishingAdminSettingsTest.php
View source
<?php
namespace Drupal\anonymous_publishing_cl\Tests;
use Drupal\simpletest\WebTestBase;
class AnonymousPublishingAdminSettingsTest extends WebTestBase {
public static $modules = array(
'node',
'comment',
'anonymous_publishing',
'anonymous_publishing_cl',
);
public static function getInfo() {
return array(
'name' => 'Anonymous Publishing',
'description' => 'Tests for the Anonymous Publishing module.',
'group' => 'Anonymous Publishing',
);
}
public function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser(array(
'administer anonymous_publishing',
));
$this
->drupalLogin($admin_user);
\Drupal::configFactory()
->getEditable('anonymous_publishing_cl.settings')
->set('allowed_content_types', array(
'article',
'comment',
))
->set('flood_limit', -1)
->set('general_options', array(
'sactivate' => TRUE,
'modmail' => FALSE,
'blockip' => FALSE,
'aregist' => FALSE,
))
->set('flood_limit', -1)
->save();
}
public function testAnonymousPublishingSettings() {
$this
->drupalGet('/admin/config/people/anonymous_publishing_cl');
$this
->assertFieldChecked('edit-allowed-content-types-article', 'Anonymous Posting for article page is activated.');
$this
->assertFieldChecked('edit-allowed-content-types-comment', 'Anonymous Posting for comments is activated.');
$this
->assertFieldChecked('edit-general-options-sactivate', 'Allow self-activation option is activated.');
$this
->assertNoFieldChecked('edit-general-options-sactstick', 'Allow self-activation sticky option is disabled.');
$this
->assertFieldById('edit-flood-limit', '-1', 'Flood limit is set to -1');
}
}