function DrupalLogErrorTest::provideFatalExitCodeData

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

File

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

Class

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

Namespace

Drupal\Tests\Core\Error

Code

public static function provideFatalExitCodeData() : array {
    $verbose = "\$GLOBALS['config']['system.logging']['error_level'] = 'verbose';";
    $scriptBody = self::getScriptBody();
    $data['normal'] = [
        "<?php\n\$fatal = TRUE;\n{$scriptBody}",
        "kernel test: This is a test message in test_function (line 456 of test.module).\n",
        "kernel test: This is a test message in test.module on line 456 backtrace\nand-more-backtrace\n",
        FALSE,
    ];
    $data['verbose'] = [
        "<?php\n\$fatal = FALSE;\n{$verbose}\n{$scriptBody}",
        "<details class=\"error-with-backtrace\"><summary><em class=\"placeholder\">kernel test</em>: This is a test message in <em class=\"placeholder\">test_function</em> (line <em class=\"placeholder\">456</em> of <em class=\"placeholder\">test.module</em>).</summary><pre class=\"backtrace\"></pre></details>",
        "",
        TRUE,
    ];
    return $data;
}

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