Unverified Commit 23d79980 authored by alexpott's avatar alexpott

Issue #3156885 by andypost, Gábor Hojtsy: Change...

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

(cherry picked from commit 9e3b13b6)
parent 0d9ca03d
......@@ -44,7 +44,8 @@ public function generateWarnings($collect_errors = FALSE) {
// 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.
......
......@@ -31,7 +31,7 @@ public function testErrorHandler() {
$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',
];
......
......@@ -111,7 +111,7 @@ public function testUncaughtException() {
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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment