Issue #3422485 by mondrake, smustgrave: Change DrupalLogErrorTest::provideFatalExitCodeData to static

(cherry picked from commit 5eca8bf8d9)
merge-requests/6829/head
Alex Pott 2024-02-29 00:47:25 +00:00
parent f07e6bb3fe
commit a89cc289c4
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
1 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ class DrupalLogErrorTest extends UnitTestCase {
* *
* @dataProvider provideFatalExitCodeData * @dataProvider provideFatalExitCodeData
*/ */
public function testFatalExitCode(string $script, string $output, string $errorOutput, bool $processIsSuccessful) { public function testFatalExitCode(string $script, string $output, string $errorOutput, bool $processIsSuccessful): void {
// We need to override the current working directory for invocations from // We need to override the current working directory for invocations from
// run-tests.sh to work properly. // run-tests.sh to work properly.
$process = new PhpProcess($script, $this->root); $process = new PhpProcess($script, $this->root);
@ -32,9 +32,9 @@ class DrupalLogErrorTest extends UnitTestCase {
$this->assertSame($processIsSuccessful, $process->isSuccessful()); $this->assertSame($processIsSuccessful, $process->isSuccessful());
} }
public function provideFatalExitCodeData() { public function provideFatalExitCodeData(): array {
$verbose = "\$GLOBALS['config']['system.logging']['error_level'] = 'verbose';"; $verbose = "\$GLOBALS['config']['system.logging']['error_level'] = 'verbose';";
$scriptBody = $this->getScriptBody(); $scriptBody = self::getScriptBody();
$data['normal'] = [ $data['normal'] = [
"<?php\n\$fatal = TRUE;\n$scriptBody", "<?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_function (line 456 of test.module).\n",
@ -50,7 +50,7 @@ class DrupalLogErrorTest extends UnitTestCase {
return $data; return $data;
} }
protected function getScriptBody() { protected static function getScriptBody(): string {
return <<<'EOT' return <<<'EOT'
if (PHP_SAPI !== 'cli') { if (PHP_SAPI !== 'cli') {
return; return;