You are here

public function ErrorLogTest::testErrorLog in Error Log 8

Tests Error Log module.

File

tests/src/Functional/ErrorLogTest.php, line 32

Class

ErrorLogTest
Tests Error Log module.

Namespace

Drupal\Tests\error_log\Functional

Code

public function testErrorLog() {
  $admin_user = $this
    ->drupalCreateUser([
    'administer site configuration',
  ]);
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/config/development/logging');
  $this
    ->submitForm([], $this
    ->t('Save configuration'));
  $log = file(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log');
  $this
    ->assertSame(1, count($log));
  $this
    ->assertSame(1, preg_match('/\\[.*\\] \\[notice\\] \\[user\\] .* Session opened for /', $log[0]));
}