diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ErrorHandlerTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ErrorHandlerTest.php index 11d1356..18160db 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ErrorHandlerTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ErrorHandlerTest.php @@ -54,7 +54,7 @@ function testErrorHandler() { ); // Set error reporting to display verbose notices. - config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); + $config->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); $this->drupalGet('error-test/generate-warnings'); $this->assertResponse(200, 'Received expected HTTP status code.'); $this->assertErrorMessage($error_notice); @@ -94,6 +94,7 @@ function testErrorHandler() { * Test the exception handler. */ function testExceptionHandler() { + $config = config('system.logging'); $error_exception = array( '%type' => 'Exception', '!message' => 'Drupal is awesome', @@ -112,6 +113,7 @@ function testExceptionHandler() { $this->drupalGet('error-test/trigger-exception'); $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.'); $this->assertErrorMessage($error_exception); + $this->assertNoRaw('
', 'Did not find pre element with backtrace class.');
 
     $this->drupalGet('error-test/trigger-pdo-exception');
     $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
@@ -121,6 +123,24 @@ function testExceptionHandler() {
     $this->assertText($error_pdo_exception['!message'], format_string('Found !message in error page.', $error_pdo_exception));
     $error_details = format_string('in %function (line ', $error_pdo_exception);
     $this->assertRaw($error_details, format_string("Found '!message' in error page.", array('!message' => $error_details)));
+    $this->assertNoRaw('
', 'Did not find pre element with backtrace class.');
+
+    // Set error reporting to display verbose notices.
+    $config->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save();
+    $this->drupalGet('error-test/trigger-exception');
+    $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
+    $this->assertErrorMessage($error_exception);
+    $this->assertRaw('
', 'Found pre element with backtrace class.');
+
+    $this->drupalGet('error-test/trigger-pdo-exception');
+    $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
+    // We cannot use assertErrorMessage() since the extact error reported
+    // varies from database to database. Check that the SQL string is displayed.
+    $this->assertText($error_pdo_exception['%type'], format_string('Found %type in error page.', $error_pdo_exception));
+    $this->assertText($error_pdo_exception['!message'], format_string('Found !message in error page.', $error_pdo_exception));
+    $error_details = format_string('in %function (line ', $error_pdo_exception);
+    $this->assertRaw($error_details, format_string("Found '!message' in error page.", array('!message' => $error_details)));
+    $this->assertRaw('
', 'Found pre element with backtrace class.');
   }
 
   /**