Unverified Commit 23d79980 authored by Alex Pott's avatar Alex Pott
Browse files

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
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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',
    ];
+1 −1
Original line number Diff line number Diff line
@@ -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');