diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index a67d091..4c2fdf0 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -992,6 +992,15 @@ protected function tearDown() { // which means they may need to access its filesystem and database. drupal_static_reset(); + if (($container = drupal_container()) && $container->has('keyvalue')) { + $captured_emails = state()->get('system.test_email_collector') ?: array(); + $emailCount = count($captured_emails); + if ($emailCount) { + $message = format_plural($emailCount, '1 e-mail was sent during this test.', '@count e-mails were sent during this test.'); + $this->pass($message, t('E-mail')); + } + } + // Ensure that TestBase::changeDatabasePrefix() has run and TestBase::$setup // was not tricked into TRUE, since the following code would delete the // entire parent site otherwise. @@ -1013,14 +1022,6 @@ protected function tearDown() { // In case a fatal error occurred that was not in the test process read the // log to pick up any fatal errors. simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE); - if (($container = drupal_container()) && $container->has('keyvalue')) { - $captured_emails = state()->get('system.test_email_collector') ?: array(); - $emailCount = count($captured_emails); - if ($emailCount) { - $message = format_plural($emailCount, '1 e-mail was sent during this test.', '@count e-mails were sent during this test.'); - $this->pass($message, t('E-mail')); - } - } // Delete temporary files directory. file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10), array($this, 'filePreDeleteCallback'));