function DrupalLogErrorTest::getScriptBody

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Error/DrupalLogErrorTest.php \Drupal\Tests\Core\Error\DrupalLogErrorTest::getScriptBody()
1 call to DrupalLogErrorTest::getScriptBody()
DrupalLogErrorTest::provideFatalExitCodeData in core/tests/Drupal/Tests/Core/Error/DrupalLogErrorTest.php

File

core/tests/Drupal/Tests/Core/Error/DrupalLogErrorTest.php, line 53

Class

DrupalLogErrorTest
Tests logging of errors in core/error.inc.

Namespace

Drupal\Tests\Core\Error

Code

protected static function getScriptBody() : string {
    return <<<'EOT'
if (PHP_SAPI !== 'cli') {
  return;
}

$autoloader = require_once 'autoload.php';
require_once 'core/includes/errors.inc';
define('DRUPAL_TEST_IN_CHILD_SITE', FALSE);

$error = [
  '%type' => 'kernel test',
  '@message' => 'This is a test message',
  '%function' => 'test_function',
  '%file' => 'test.module',
  '%line' => 456,
  '@backtrace_string' => "backtrace\nand-more-backtrace",
  'severity_level' => 0,
  'backtrace' => [],
  'exception' => NULL,
];
_drupal_log_error($error, $fatal);
EOT;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.