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.
See #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
This issue is postponed, blocked by #2866513: Convert web tests to browser tests for comment module
This issue is postponed, blocked by #2863626: Convert web tests to browser tests for image module
Scope:
All tests in rdf/src/Tests
Comment | File | Size | Author |
---|---|---|---|
#53 | 2864035-53.patch | 9.92 KB | alexpott |
#50 | 2864035-50.patch | 10.91 KB | alexpott |
#45 | interdiff-42-45.txt | 1.93 KB | Anonymous (not verified) |
#45 | 2864035-45.patch | 11.55 KB | Anonymous (not verified) |
#42 | 2864035-42.patch | 10.9 KB | alexpott |
Comments
Comment #2
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedI use -M and --find-copies-harder but it don't see GetNamespacesTest.php is moving and changed.
Comment #3
dawehnerIf you really want to use strpos you can use
$this->assertContains
instead which has some better readability.Comment #4
mpdonadioThe two files are pretty different, so I am not surprised they don't count as a move:
Attached is the straight move w/ rename+replace. It is going to fail, which concerns me. The same xpath expression that the test generates works in Chrome element inspect, which may mean we don't have a 1-to-1 conversion with xpath in WTB and BTB (and I don't see why this xpath is failing in BTB).
Comment #5
mpdonadioGo, testbot go.
Comment #7
mpdonadioOK, I think the problem is that WTB::xpath() and BTB::xpath() work from different root elements (see http://mink.behat.org/en/latest/guides/traversing-pages.html).
This converts everything to use CSS traversal to get around the clunky xpath that you now have to use.
So, we may need a followup about BTB::xpath()...
Also noticed that Drupal\rdf\Tests\Field\TestDataConverter is orphaned, and not used in core (well, PHPStorm says so and it is smarter than me). Should we add a @deprecated to it in this patch? It's the only file left in core/modules/rdf/src/Tests now.
Comment #8
mpdonadioCreated #2864201: XPath in WebTestBase and BrowserTestBase use different roots.
Comment #9
dawehnerI actually believe
\Drupal\Tests\rdf\Kernel\Field\FieldRdfaDatatypeCallbackTest
is using that ... you know callables :)Comment #10
mpdonadioThat's what I get for trusting Find Usages and not searching for the string...
Should we move that file to live alongside the test that uses it? I suspect that was missed during #2684095: Convert field kernel tests to KernelTestBaseTNG. Or is that out of scope?
Comment #11
dawehnerI think keeping the file where it is for now is totally cool. I actually like to not have tests and helper stuff in the same directory, but we could always deal with that in a followup, if you actually care.
Comment #12
mpdonadioNo string feelings one way or another. Let's commit this.
Comment #13
alexpottThis is still extending from a WebTestBase test...
\Drupal\comment\Tests\CommentTestBase
This doesn't look right. I think we also need to update
\Drupal\image\Tests\ImageFieldTestBase
to point at the browsertestbase version of the base test.Comment #14
mpdonadio#13-1 means we need to postpone on #2866513: Convert web tests to browser tests for comment module.
#13-2 is an easy switch, but the test fails b/c TestFileCreationTrait::drupalGetTestFiles() doesn't exist for BTB, so that test needs to be adjusted.
This patch will fail, but does the class switches from #13, but not the other fix.
Comment #15
mpdonadioAnd we are double-postponed, #2863267: Convert web tests of views
Comment #16
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI think you meant #2863626: Convert web tests to browser tests for image module?
Comment #17
mpdonadioNo, I did mean #2863267: Convert web tests of views. That issue is blocking #2866513: Convert web tests to browser tests for comment module, which is blocking this one. I suspect we may also be blocked on the image module; I kinda gave up after digging through the comment-related tests and noticing we are at least double postponed (which kinda of makes sense considering what rdf.module does).
Comment #18
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedA right, I figured it wasn't directly postponed on views but via comment.
I've been working the issue queue and changing the scope for a lot of issues so they can be unpostponed but for the rdf module it doesn't make sense. Will probably take a while before we can RTBC this one..
Comment #19
dawehnerIMHO we should get the conversations in, and then make a final run for all the views related test classes. I strongly recommend for running things in parallel vs. serial :)
Comment #20
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commented@dawehner: I agree completely but in this case there's not much left if we split all the tests that require another base class.
Comment #21
dawehnerFair point :)
Comment #23
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated summary to show that this issue is blocked by #2866513: Convert web tests to browser tests for comment module
Comment #24
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedWork can re-start now that #2866513: Convert web tests to browser tests for comment module has landed
Comment #25
naveenvalechaHere we go with the patch.
There's still one class left in the src/Tests namespace Drupal\rdf\Tests\Field\TestDataConverter which is used by the Drupal\Tests\rdf\Kernel\Field\FieldRdfaDatatypeCallbackTest This class conversion seems unrelated to this issue. Do we want to deal it here or in follow-up?
Comment #27
nlisgo CreditAttribution: nlisgo commentedI'm going to take a look at this issue and see if I can resolve some of these failing tests.
Comment #28
mpdonadioI think this may be hard blocked on #2863626: Convert web tests to browser tests for image module now.
Comment #29
nlisgo CreditAttribution: nlisgo commented@mpdonadio you may be right. I am addressing the failing tests in Drupal\Tests\rdf\Functional\GetNamespacesTest for now.
Targeted attributes of the html element are made a little bit more tricky by //html being prefixed onto each xpath query. There may be a better way to do this but these changes will perform the appropriate check.
Switching to Needs review to trigger testbot
Comment #31
nlisgo CreditAttribution: nlisgo commentedI have screwed up the patch in #29. I will resupply.
Comment #32
nlisgo CreditAttribution: nlisgo commentedI'm resupplying the patch intended for #29. I performed the diff for 8.4.x rather than 8.5.x.
Triggering testbot.
Comment #34
nlisgo CreditAttribution: nlisgo commentedComment #35
nlisgo CreditAttribution: nlisgo commentedI introduced some whitespace into my last patch. Resupplying.
Comment #36
nlisgo CreditAttribution: nlisgo commentedWe need to postpone on #2863626: Convert web tests to browser tests for image module
Comment #38
alexpottDoing this conversion has thrown up a few bugs in the File and Image test base conversions. No interdiff because it has been a while.
Comment #39
alexpottWhoops missed Image test base fix.
Comment #42
alexpottWhoops wrong namespace.
Comment #43
LendudeNice merging!
Hehe and then all the find()s start with //html anyway :).
Great clean minimal conversion, completely cleans out the rdf/src/Tests dir, nice!
Comment #45
Anonymous (not verified) CreditAttribution: Anonymous commented@Lendude suggested moving some changes from #2946425: Correcting the tests that lie in BTB but using WTB to here.
This is problem of FileFieldTestBase (like and 'Save and keep published' / 'Save')
One more test with incorrect parent class (like and FileFieldAttributesTest)
Comment #46
alexpott@vaplas nice changes!
Should this go into ImageFieldTestBase too? I think so.
Comment #47
Anonymous (not verified) CreditAttribution: Anonymous commented#46: @alexpott, thanks and good question! But looks like not:
ImageFieldAttributesTest extends ImageFieldTestBase
instead of FileFieldTestBase.drupalGetTestFiles()
.So, perhaps it is separate case of using
drupalGetTestFiles
alias.Comment #48
LendudeAdditional changes look good and feedback has been addressed.
Comment #50
alexpottRerolled... well git did...
Comment #52
Anonymous (not verified) CreditAttribution: Anonymous commentedUnrelated fail.
Comment #53
alexpottRerolled because #2863626: Convert web tests to browser tests for image module landed which contained identical changed to
core/modules/image/tests/src/Functional/ImageFieldTestBase.php
.Thanks git rebase!
Comment #54
larowlanAdding review credits
Comment #57
larowlanCommitted as 98093be and pushed to 8.6.x
Cherry-picked as 5779395 and pushed to 8.5.x
More down
Comment #58
Anonymous (not verified) CreditAttribution: Anonymous commentedThank you! Now FileFieldTestBase will finally become usable 🎉🎉🎉