JsonLogConfigFormTest.php in JSONlog 3.x
File
tests/src/Functional/JsonLogConfigFormTest.php
View source
<?php
namespace Drupal\Tests\jsonlog\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class JsonLogConfigFormTest extends BrowserTestBase {
const JSONLOG_SITEID_FIELD_NAME = 'jsonlog_siteid';
const JSONLOG_SITEID_FIELD_VALUE = 'testname';
public static $modules = [
'jsonlog',
'node',
];
protected $user;
protected function setUp() {
parent::setUp();
$this->user = $this
->drupalCreateUser([
'administer site configuration',
]);
}
public function testLoggingConfigFormContainsJsonlogSettings() {
$this
->drupalLogin($this->user);
$this
->drupalGet(Url::fromRoute('system.logging_settings'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains(t('JSON LOG'));
$this
->drupalPostForm('admin/config/development/logging', [
self::JSONLOG_SITEID_FIELD_NAME => self::JSONLOG_SITEID_FIELD_VALUE,
], t('Save configuration'));
$this
->assertSession()
->pageTextContains(t('The configuration options have been saved.'));
$this
->drupalGet('admin/config/development/logging');
$this
->assertSession()
->fieldValueEquals(self::JSONLOG_SITEID_FIELD_NAME, self::JSONLOG_SITEID_FIELD_VALUE);
}
}