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.
Follow-up to #2752659: [META] Convert SimpleTest Tests to PHPUnit
Core is deprecating SimpleTest for Drupal 9 and converting all the tests #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase).
We should also do this. This issue will be used to move the base classes and do a bulk update for all tests that don't need a lot of special handling.
Comment | File | Size | Author |
---|---|---|---|
#20 | 2753889-20.patch | 92.54 KB | Lendude |
| |||
#20 | interdiff-2753889-18-20.txt | 754 bytes | Lendude |
#18 | 2753889-18.patch | 92.51 KB | Lendude |
#18 | interdiff-2753889-16-18.txt | 1.62 KB | Lendude |
#16 | 2753889-16.patch | 92.52 KB | Lendude |
Comments
Comment #2
jmuzz CreditAttribution: jmuzz commentedThis conversion will mean changing it from a WebTestBase to a BrowserTestBase. That means all the classes that extend it change too. They will need to be done in the same patch.
This includes:
Comment #3
GoZ CreditAttribution: GoZ at Centarro commentedI think child issues are better than putting all conversions on one patch. It's easier to contribute.
We should at first convert ParagraphsTestBase and then convert other tests once this one is commited.
Comment #4
jmuzz CreditAttribution: jmuzz commentedOk maybe I can do a better job of explaining this...
Once the testbase gets converted to BrowserTestBase all the tests that are extending it will stop working and no longer pass. That's why such a patch can not be committed on its own.
Comment #5
jmuzz CreditAttribution: jmuzz commentedCome to think of it, it may be possible if ParagraphsTestBase can be changed into ParagraphsTestTrait for this issue so the classes using it can extend WebTestBase directly until they get worked on in their own issues.
Comment #6
jmuzz CreditAttribution: jmuzz commentedHere is a patch that will allow the tests using ParagraphsTestBase to be worked on separately. I tried to move the new ParagraphsTestTrait to tests/src/Functional but the autoloader only finds stuff descending from src. It could be moved after all of the classes using it are converted and moved. That would be the last step in converting ParagraphsTestBase to PHPUnit.
Comment #7
miro_dietikerI see that moving to a trait works, but adds lots of duplication in module dependency declaration.
Is the previous test base also valuable for other tests that are currently not built on top of ParagraphsTestBase?
Otherwise i don't see why switching away from a base class is an improvement?
Comment #8
jmuzz CreditAttribution: jmuzz commented@miro_dietiker I am not sure how I can explain the reasoning behind the change any better than I already did. Is there anything particular in my posts that doesn't seem to make sense? I may be able to break it down more.
Comment #9
BerdirNot sure.
If we'd have dozens of tests, then maybe doing child issues might be better, but you already end up changing all subclasses now too, so what's the benefit? Core also doesn't do it per class, but is discussing about what the best way to group them is. And I think one of the suggestions is to do it per base class, when there is one.
I also think we already have an issue for this, where someone started to convert to javascript test base. We discused there that it's not needed for all classes but actually, I can see drupalPostAjaxForm() calls in 9 of the 11 test web tests. Either we find a way to not use ajax for them or we have to make them JS tests.
Given that, not exactly sure. Open to make it a trait, especially since we seem to need at least two different base classes. But maybe we could keep the base classses, exactly to avoid changing the subclasses and duplicate the modules everywhere? We could do that + convert everything we can to BTB and then do the remaining ones to javascript tests.
Comment #10
jmuzz CreditAttribution: jmuzz commentedSo the best case scenario would be if all the tests using this baseclass could be converted to BrowserTestBase and the ajax removed from them and it was all done at once as per #2. It may be possible, the interface is all supposed to work without javascript in theory.
Comment #11
jmuzz CreditAttribution: jmuzz commentedThis passes for me and includes all the tests listed in #2. Setting to postponed because it depends on the patches in the core issues I'm relating.
Comment #12
KingdutchMoving this to "Needs Review". The second of the two issues was just committed to 8.6.x and 8.7.x (the first being fixed in 8.3.x).
Comment #14
LendudeContinuing the work from #2752659: [META] Convert SimpleTest Tests to PHPUnit here.
This removes the call to assertNoErrorsLogged() which has no replacement, and reverts ParagraphsExperimentalTranslationTest back to simpletest for now.
Comment #15
BerdirHm, is that really not required anymore? I'm wondering why we added those calls. phpunit fails if it detects an error I think, but so did simpletest.
We have 3 of these calls in total, this one was added by #2851402: Error on subform state when removing/adding container . I tried to undo the fix to see if it still fails, but it the code has changed and I didn't manage to produce an error. So, fine with removing this.
We already have some actual JS tests we can always add more, but I'm happy if as much as possible don't need to be. Much better for test performance as long as we can't run then in parallel.
FieldUiTestTrait is an 8.7 deprecation, so I plan to commit this after the next release (should happen this week?) and update our dependency definition.
Since we already touch some of the existing browser tests to update the use statements, wondering if we should go one step further and also use the new base class there now, should save us a few lines duplicating the traits in all of them?
Comment #16
LendudeHmm? Javascript tests run with concurrency 15 (PhantomJs couldn't, Chrome/Webdriver can)
This changes the existing browsertestbase test to use the new Base classes. Also moved them to the classic/experimental dirs where possible. There are 3 tests that already exist inside the new dirs (name wise), so left them for now, they probably need to be merged or something, but that might make this harder to review, so left them for now.
Didn't run the tests locally, so this might fail spectacularly :)
Comment #18
LendudeThis should clear up the fails
Comment #20
Lendude....
Comment #22
BerdirThanks, committed. Also updated the core dependency to 8.7.