You are here

public function JsonLogConfigFormTest::testLoggingConfigFormContainsJsonlogSettings in JSONlog 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/JsonLogConfigFormTest.php \Drupal\Tests\jsonlog\Functional\JsonLogConfigFormTest::testLoggingConfigFormContainsJsonlogSettings()
  2. 3.x tests/src/Functional/JsonLogConfigFormTest.php \Drupal\Tests\jsonlog\Functional\JsonLogConfigFormTest::testLoggingConfigFormContainsJsonlogSettings()

Tests that the settings page is available and we can save.

File

tests/src/Functional/JsonLogConfigFormTest.php, line 47

Class

JsonLogConfigFormTest
Simple test to ensure that main page loads with module enabled.

Namespace

Drupal\Tests\jsonlog\Functional

Code

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);
}