Issue #3156885 by andypost, Gábor Hojtsy: Change \Drupal\error_test\Controller\ErrorTestController::generateWarnings() to throw E_NOTICE error compatible with PHP 8

merge-requests/25/head
Alex Pott 2020-09-08 14:36:17 +01:00
parent 11118a3416
commit 9e3b13b6fb
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
3 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,8 @@ class ErrorTestController extends ControllerBase {
// Tell Drupal error reporter to send errors to Simpletest or not.
define('SIMPLETEST_COLLECT_ERRORS', $collect_errors);
// This will generate a notice.
$monkey_love = $bananas;
$bananas = [];
$monkey_love = $bananas[1];
// This will generate a warning.
$awesomely_big = 1 / 0;
// This will generate a user error. Use & to check for double escaping.

View File

@ -31,7 +31,7 @@ class ErrorHandlerTest extends BrowserTestBase {
$config = $this->config('system.logging');
$error_notice = [
'%type' => 'Notice',
'@message' => 'Undefined variable: bananas',
'@message' => 'Undefined offset: 1',
'%function' => 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()',
'%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
];

View File

@ -111,7 +111,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
public function testUncaughtFatalError() {
$fatal_error = [
'%type' => 'TypeError',
'@message' => 'Argument 1 passed to Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}() must be of the type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 62',
'@message' => 'Argument 1 passed to Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}() must be of the type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 63',
'%function' => 'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()',
];
$this->drupalGet('error-test/generate-fatals');