Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
SimpleTest is no longer useful, everyone has migrated to PHPUnit.
There is still support code for SimpleTest tests in TestDiscovery and TestRunnerKernel (and probably some related classes).
Steps to reproduce
Proposed resolution
Remove code relating to SimpleTest-based tests from these classes.
Deprecation is not required as tests are considered internal and users have had the full Drupal 9 cycle to upgrade to PHPUnit.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
The SimpleTest module was moved to contrib prior to Drupal 9.0.0. Drupal 10 removes support for SimpleTest from the core test runner. Projects that use SimpleTest should convert their tests to PHPUnit.
Comment | File | Size | Author |
---|---|---|---|
#16 | interdiff.3254726.12-16.txt | 1.44 KB | longwave |
#16 | 3254726-16.patch | 27.75 KB | longwave |
| |||
#12 | 3254726-12.patch | 27.51 KB | longwave |
| |||
#10 | 3254726-10.patch | 28.02 KB | longwave |
#6 | interdiff.3254726.2-6.txt | 10.84 KB | longwave |
Comments
Comment #2
longwaveComment #3
longwaveTestDiscovery has support for parsing
@dependencies
in docblocks; is this a SimpleTest-ism that can be removed?Comment #4
longwaverun-tests.sh can probably be cleaned up some more. I find this hard to edit in PhpStorm as it's convinced it is a shell script :)
Comment #5
longwaveTestDiscovery::parseTestClassAnnotations() seems to be some kind of extra support for PHPUnit, but doesn't appear to be called.
Comment #6
longwaveRe #3/#5 - PHPUnit uses
@requires module
to do this instead,TestRequirementsTrait
deals with this now andTestDiscovery::parseTestClassAnnotations()
appears to be dead code.Addressed #4, cleaned up some more SimpleTest-only code from run-tests.sh.
Comment #7
longwaveComment #8
longwaveFix unused use statement.
Comment #9
longwave...and upload the patch instead of an interdiff.
Comment #10
longwaveThird time lucky?
Comment #12
longwaveTwo more test cases can be deleted if we don't support
@dependencies
.Comment #13
Mile23Anything that says 'remove simpletest support' in the title gets +1 from me.
Comment #14
Mile23Comment #15
mondrakeCan we mark this class @internal?
Can we mark this class @internal?
maybe we can remove 'Simpletest' from the statement and just say sth like 'Missing database schema to collect test results'
Are we sure? I think we still need to have a way to allow testing artifacts to be stored somewhere... and currently that is all over the place (for instance, the HTML output is in a folder that is not touched by the cleanup IIRC). I suggest to leave this in ATM and look to streamline artifact management. But that will take longer and certainly involve infra.EDIT: sorry I misread 4. It's OK.
Comment #16
longwaveThanks for reviewing, rerolled and addressed #15.
Comment #17
mondrakeGreat
Comment #18
catchI'm not 100% sure this is simpletest-specific despite the name - won't it also clean up child sites for phpunit functional tests?
Comment #19
longwaveBTB extends TestCase:
In fact all PHPUnit tests extend TestCase, so that
if
quoted in #18 will always be true, hence the whole thing can be refactored away.PHPUnit functional tests do their cleanup in
BrowserTestBase::cleanupEnvironment()
.Comment #20
mondrake#18 same pitfall of my reasoning in #15.4. But we are removing the code that removes the artifacts, so they will be staying forever... which is fine since anyway the PHPUnit ones are not touched by the script.
xpost with #19
Comment #21
mondrakeBTW we badly miss tests here, so better remove dubious code if we don't want to add some... I tried to start something in the past #3075608: Introduce TestRun objects and refactor TestDatabase to be testable but that never happened.
Comment #22
catchDoh, makes sense.
Committed fece49c and pushed to 10.0.x. Thanks!
Comment #25
catchThis missed a phpstan baseline entry, I've done that locally and pushed:
Comment #26
Mile23❤️
Comment #27
xjmThis should probably go in the release notes. Adding a release note draft.
Comment #28
xjm