You are here

public function LoggerWebTest::testLoggerException in Ultimate Cron 8.2

Tests that the logger handles an exception correctly.

File

tests/src/Functional/LoggerWebTest.php, line 60

Class

LoggerWebTest
Tests that scheduler plugins are discovered correctly.

Namespace

Drupal\Tests\ultimate_cron\Functional

Code

public function testLoggerException() {
  \Drupal::state()
    ->set('ultimate_cron_logger_test_cron_action', 'exception');

  // Run cron to get an exception from ultimate_cron_logger_test module.
  $this
    ->cronRun();

  // Check that the error message is displayed in its log page.
  $this
    ->drupalGet('admin/config/system/cron/jobs/logs/ultimate_cron_logger_test_cron');
  $this
    ->assertRaw('/core/misc/icons/e32700/error.svg');
  $this
    ->assertRaw('<em class="placeholder">Exception</em>: Test cron exception in <em class="placeholder">ultimate_cron_logger_test_cron()</em> (line');
}