- Issue created by @mondrake
- ๐ฎ๐นItaly mondrake ๐ฎ๐น
One proposal could be to replace the annotation
@requires module xxxx
with an attribute, say#[RequiresDrupalModules(['xxxx'])
, and usual deprecation dance.However, there only are 3 tests using this feature:
- KernelTestBaseTest
- BrowserTestBaseTest
- FileUploadTest
Two are to test the feature itself, and for the third (FileUploadTest) the check is actually not even triggered, not sure why - but in any case it can be replace with a simple
markTestSkipped
.So not sure - is it something we need to keep supporting, or can we get rid of it altogether?
- ๐ฌ๐งUnited Kingdom longwave UK
This has been broken for some time, see #3261817: TestRequirementsTrait::checkRequirements() does not work as expected โ
- ๐ฎ๐นItaly mondrake ๐ฎ๐น
Well two years not working means no one needs it. I propose to deprecate for removal.
- ๐ณ๐ฑNetherlands spokje
Well two years not working means no one needs it. I propose to deprecate for removal.
Valid point IMHO, deprecation dance++
- Status changed to Needs review
12 months ago 9:25pm 31 January 2024 - Status changed to RTBC
12 months ago 2:47pm 1 February 2024 - ๐บ๐ธUnited States smustgrave
Deprecation seems good and has test coverage.
- ๐ณ๐ฑNetherlands spokje
After a night sleep (I know, I shouldn't do that...), I'm a bit worried to drop this functionality.
Core doesn't use it, that's clear by now, and it's broken, but contrib uses it (a lot): http://codcontrib.hank.vps-private.net/search?text=%40requires%20module&...
Not sure if since it's not working, fixing it/replacing it with an annotation could/would mean contrib tests will break, or is this long superseded by adding the modules-on-which-to-depend in the
require-dev
section of the modulescomposer.json
and is this also dead code in contrib? - ๐ฎ๐นItaly mondrake ๐ฎ๐น
This has probably been broken for 4 years now, since when #2950132: Support PHPUnit 7 optionally in Drupal 8, while keeping support for ^6.5 โ was committed.
Personally in the contrib modules I maintain I add the test required modules in the require-dev of the composer.json file. In fact itโs a must have if you want the CI tools to install them.
- ๐ฌ๐งUnited Kingdom longwave UK
Given there was little activity over in #3261817: TestRequirementsTrait::checkRequirements() does not work as expected โ I also suspect this has been broken since then but nobody in contrib land has noticed, so to me that means it's not worth maintaining (or in this case, refactoring for PHPUnit 10), and so I agree this should be deprecated for removal.
- ๐ณ๐ฑNetherlands spokje
Personally in the contrib modules I maintain I add the test required modules in the require-dev of the composer.json file.
(Emphasis mine)
Thanks, there we have it, kill it with fire!
- ๐ฌ๐งUnited Kingdom longwave UK
We should have a followup though to clean up FileUploadTest, as those are six test methods that we should skip entirely if we can.
- Status changed to Needs work
12 months ago 5:58pm 1 February 2024 - ๐ฎ๐นItaly mondrake ๐ฎ๐น
I think better to that here, itโs an unusual deprecation and leving things around wonโt be good. Threโs a comment somewhere, too.
- Status changed to Needs review
12 months ago 7:25pm 1 February 2024 - Status changed to RTBC
12 months ago 7:49pm 1 February 2024 - ๐ณ๐ฑNetherlands spokje
Clean up makes sense, nice catch in
core/tests/Drupal/KernelTests/KernelTestBase.php
- ๐ณ๐ฟNew Zealand quietone
The wiki has a reference to using
@requires module
that should be removed.https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/phpunit-... โ
- ๐ณ๐ฑNetherlands spokje
Thanks @quietone, removed section from the wiki page.
-
longwave โ
committed 614ff9d2 on 11.x
Issue #3418379 by mondrake, Spokje: Deprecate Drupal\Tests\...
-
longwave โ
committed 614ff9d2 on 11.x
- Status changed to Fixed
12 months ago 11:26am 2 February 2024 Automatically closed - issue fixed for 2 weeks with no activity.