You are here

public function LoggerWebTest::testLoggerLongMessage in Ultimate Cron 8.2

Tests that the logger handles long message correctly.

File

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

Class

LoggerWebTest
Tests that scheduler plugins are discovered correctly.

Namespace

Drupal\Tests\ultimate_cron\Functional

Code

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

  // Run cron to get a long message log from ultimate_cron_logger_test.
  $this
    ->cronRun();

  // Check that the long log message is properly trimmed.
  $this
    ->drupalGet('admin/config/system/cron/jobs/logs/ultimate_cron_logger_test_cron');
  $xpath = $this
    ->xpath('//table/tbody/tr/td[4]');

  // The last 2 chars from xpath are not related to the message.
  $this
    ->assertTrue(strlen(substr($xpath[0]
    ->getText(), 0, -2)) == 5000);
  $this
    ->assertRaw('This is a v…');
}