Closed (outdated)
Project:
Drupal core
Version:
main
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Aug 2016 at 09:45 UTC
Updated:
30 Mar 2026 at 14:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mile23Marking this as a duplicate of #2794715: TestSuiteBaseTest cannot be executed as standalone test since it's two errors requiring the same solution. If we decide something else there, we can re-open here.
Comment #3
mile23In #2794715-10: TestSuiteBaseTest cannot be executed as standalone test it was decided that the solution to this issue would be too disruptive for 8.2.x, so if we're going to move files around in namespaces we should do that for 8.3.x.
Here's the patch from #5 in that issue. It will likely need to be re-rolled after that issue is committed.
Comment #4
dawehnerThis solution is still super nice!
Comment #5
xjmThanks @Mile23; I agree with splitting the changes this way. I think a change record for this change would probably be good?
Comment #6
mile23OK so this patch moves the test suite classes to
\Drupal\TestSuites\*and has the test in\Drupal\Tests\TestSuites\TestSuiteBaseTest.It changes the test so that it doesn't need
require_onceas per #2794715: TestSuiteBaseTest cannot be executed as standalone testWe can still run
TestSuiteBaseTestas a single test:Change record coming up. We should have made a change record for #2499239: Use test suite classes to discover different test types under phpunit, allow contrib harmony with run-tests so I'll include that.
Comment #7
dawehnerStill like this fix :)
We still need some change record :)
Comment #8
mile23Someone asked for a change record? https://www.drupal.org/node/2799437
Comment #9
dawehnerThanks a ton!
Comment #11
mile23Failed test is FeedAdminDisplayTest, which I'm willing to bet is unrelated. Resetting to RTBC and restarting testbot.
Comment #12
alexpottWe need to be changing the autoloader less under testing not more. The test suite classes have no need to be autoloaded.
Comment #13
klausiAgreed, can we just move the test suite classes to core/tests/Drupal/Tests?
I know the test suites are not unit tests, but that way we avoid modifying the auto loader yet again and can still remove the require_once statements.
Comment #14
mile23Not sure why that's needed. @alexpott is talking about not allowing autoloading for the test suites *at all.* It's a good ideal.
Comment #15
klausiso this line should not be added?
I find this require_once hackery in all the classes annoying. Any Drupal contrib module that wants to use TestSuiteBase has to do some require_once weirdness yet again :(
Comment #16
alexpottTestSuiteBase is not an extension point. How exactly is a contrib module going to use TestSuiteBase?
Comment #17
alexpott@klausi the line should not be added because changing the autoloader because of the test system is wrong. The autoloader should match the environment without the test system in play.
Comment #18
mile23Ewps... Missed changing that one line in bootstrap for the last patch.
As for contrib using the suite classes.. I'm not sure what the use-case is. I'd really rather see more of core use these, though, for uses like the UI runner. If that need arises, we can maybe just change it back.
Comment #19
mile23If that's the case, then there's a logical follow-up to modify bootstrap.php to not change the autoloader. But, you know... good luck. :-) We have to discover extension tests in arbitrary locations.
Comment #21
mile23Restarting test after CI error.
Comment #25
borisson_Patch no longer applies. It looks very good though and has been rtbc 3 times already.
Comment #26
mile23Reroll.
Also, the
require_oncewould mean that the class was hanging around for all subsequent tests, so I refactoredTestSuiteBaseTesta little to use a mock instead of a subclass, and added@runTestsInSeparateProcesses.Comment #28
mile23OK, so if we isolate the test system from the system under test, then the test listener can't find
TestSuiteBasefor@coversDefaultClass, as the fail in #26 shows:This tests passes locally for me because I use
--testsuite unitto run it, which loadsTestSuiteBasein order to do discovery.Keeping the classloader isolation seems to be an important restriction from #16 and #17, so we'll remove
@coversDefaultClass/@coversand turn them into documentation.Comment #29
borisson_#28 and the reasons for removing @covers sounds like a super solid idea.
Comment #30
alexpottWon't these changes break everyone's customised phpunit.xml files? I think we shouldn't make this change in this way.
Comment #40
smustgrave commentedAgree with @alexpott this will break local uniting testing.
Comment #43
dcam commentedTest suites were dropped from PHPUnit 10. We deprecated them during the Drupal 10 cycle and removed from Drupal 11, CR: https://www.drupal.org/node/3405829.
TestSuiteBaseTeststill exists, but no longer has the include statement because the target class was deleted. Closing as outdated.Comment #45
dcam commented