Problem/Motivation
This issue supports #2807237: PHPUnit initiative
It's a child of #2863044: [plan] Remove simpletest dependencies from PHPUnit-based tests
We have a long-standing issue about removing the caching of results in TestDiscovery
: #1667822: Remove caching of test classes in TestDiscovery
We also have a need to remove TestDiscovery
from the simpletest module context. Currently it's a service defined by simpletest module, but is only used as a service by simpletest module's test list form, which we want to phase out. It's used as a class by behaviors we want to keep, such as TestSuiteBase
and run-tests.sh
.
TestDiscovery also declares a dependency on ModuleHandlerInterface
which is used to support hook_simpletest_alter()
.
Proposed resolution
Turn TestDiscovery
into a lean, mean, test discovering machine, with few external dependencies.
Keep a deprecated stub Drupal\simpletest\TestDiscovery
class which subclasses the new one. This allows BC for code which passes the now-unused dependencies.
Have the new class not cache results beyond static, because developers are adding and moving tests all the time, and will need to invalidate the cache every time they do. The cache system is also a dependency which TestDiscovery
currently manages as a special case, so this amounts to removing that special case. Work underway here: #1667822: Remove caching of test classes in TestDiscovery
Move TestDiscovery
outside of the simpletest module context, so it's not dependent on the module. Also move MissingGroupException
which it depends on. Move them to core/tests
.