Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294902

Simpletest module crashes on cleanup, uninstall

$
0
0

Problem/Motivation

We see: Fatal error: Trait 'Drupal\Tests\SessionTestTrait' not found See comment #10 for a stack trace.

Steps to reproduce (only with Drupal Core)

  • run on the Testing UI a test that ends up in a fatal error
  • end up on a page like e.g.
    An error has occurred.
    Please continue to the error page
    An AJAX HTTP error occurred.
    HTTP Result Code: 200
    Debugging information follows.
    Path: /[...]/batch?id=67&op=do_nojs&op=do
    StatusText: OK
    ResponseText:
    Fatal error:  Call to undefined method Drupal\file_mdm\FileMetadataManager::useUri() in /[...]/modules/file_mdm_exif/src/Tests/FileMetadataExifTest.php on line 107
  • click on the link to the error page
  • bum: Fatal error: Trait 'Drupal\Tests\SessionTestTrait' not found in /[...]/core/modules/simpletest/src/TestBase.php on line 28

Steps to reproduce (using Drush)
drush php-eval 'simpletest_clean_environment()'

It turns out that some refactoring related to WTB->BTB conversions moved the traits required by TestBase into the core/tests/ directory, which is only autoloadable during test run-time. This means that during normal run-time those traits are not discoverable.

This also led to another issue with simpletest_clean_environment(), which similarly needs to load TestBase. During uninstall time for simpletest, PHP is unable to completely load TestBase: #2799333: Fatal error when uninstall Testing module due to traits of TestBase

Proposed resolution

For _simpletest_batch_finished():

Minimally refactor TestBase::insertAssert() to TestDatabase::insertAssert(). This is a better place for that method anyway, and TestDatabase does not require special class loading.

For simpletest_clean_environment():

Ensure that simpletest_clean_environment() loads the \Drupal\Testing namespace by calling registerTestNamespaces() on the test_discovery service.

Remaining tasks

File an issue to deprecate TestBase::insertAssert() and TestBase::deleteAssert() in favor of duplicate methods on TestDatabase.

Refactor the simpletest_cleanup*() methods into a more maintainable helper class/service: #2800267: Turn simpletest_clean*() functions into a helper class/service

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 294902

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>