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.
Child to #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
Comments
Comment #2
jibranPending on #2750941: Additional BC assertions from WebTestBase to BrowserTestBase.
Comment #3
klausiwe should not change this in this conversion issue because assertNoRaw() will be added by #2750941: Additional BC assertions from WebTestBase to BrowserTestBase.
Same here, there will be assertNoRaw().
hm, that is kind of an API change. But I guess since we don't have placeBlock() for long this is OK to do.
Comment #4
jibranYeah I'm waiting for #2750941: Additional BC assertions from WebTestBase to BrowserTestBase to be committed.
How do we want to tackle this?
Comment #5
klausiAs usual: create a deprecated method on AssertLegacyTrait and do the equivalent thing with WebAssert there.
Comment #6
jibranRe-roll after #2750941: Additional BC assertions from WebTestBase to BrowserTestBase. Added the helper methods as mentioned in #5. Fixed #3 as well.
Comment #7
klausiLet's not change this line if we don't have to. PHP will forgive us if we just pass one parameter too much. This can be cleaned up later, let's keep the conversion patches small.
Same for the other places.
Can you extract this and other changes on AssertLegacyTrait and create a new patch in #2750941: Additional BC assertions from WebTestBase to BrowserTestBase?
we should add a test case for BrowserTestBase for this. Can you open a new issue and do that?
This can return NULL if the variable has not been initialized. Should we initialize the class variable as array()?
type hint to array missing for the parameter.
Comment #8
jibranThanks for the review.
Comment #9
jibranComment #10
klausiassertPattern() is deprecated, if we change the line we should do it properly. Two possibilities:
1) don't change the line.
2) change the line to $this->assertSession()->... which is not deprecated.
Comment #11
jibranLet's do 1) then
Comment #12
klausiAll assert methods on AssertLegacyTrait should be deprecated. What should developers use instead? If we cannot find something good on Mink's WebAssert then we need to implemented this on our own WebAssert class.
same here.
Can be replaced with just $this->assertNotFalse($first_occurence, $message);
let's always use "===" for consistency.
any progress on the new issue that should introduce tests for this?
Comment #13
jibranComment #14
klausiThanks!
Why do we even have to store that on every single drupalGet() request? We can just do that in a method on demand. So I think the getDrupalSettings() method can just do the regex extraction when needed.
Not happy about the method naming, but I guess we want to keep the name for campatibility reasons? Also the short description should mention JavaScript to make it immediately clear.
@return should say "The JSON decoded array of JavaScript drupalSettings from the current page."
why do we need the setter? What would be the use case to artificially set the javascript? I think this method should be removed.
I think we should put all our assert methods on WebAssert and not mix some into BrowserTestBase and some on WebAssert.
Fine with me if you want to develop the test cases in this issue and then extract them later.
Comment #15
jibranThanks for another round.
WebAssert
and I don' t think @dawehner would like it very much.Comment #16
klausiExtracted the JS settings method to #2759859: Implement getDrupalSettings() on BrowserTestBase for checking JS settings.
Comment #17
claudiu.cristeaComment #18
claudiu.cristeaComment #19
claudiu.cristeaRemoved also some messages.
Comment #20
klausithis line should not be changes, we should have assertPattern on the legacy trait.
this line should not be changes, we should have assertUniqueText() on the legacy trait.
we decided in #2759879: Additional assertions for WebAssert and AssertLegacyTrait, part 2 that we don't want to add this to our WebAssert.
I think we should not remove the messages with this patch, only makes it harder to review. The messages should be removed when the deprecated method calls are removed and WebAssert is used instead.
Comment #21
claudiu.cristeaOK
Comment #22
klausiLooks good! We need to get in #2759879: Additional assertions for WebAssert and AssertLegacyTrait, part 2 first.
Comment #23
claudiu.cristeaSorry, why postponing? Let's leave both in race. One will be committed first, the other will be rerolled accordingly.
Comment #24
klausiThe problem is that reviewers have to do double work now. Is the patch proposed here really doing the same thing as in the other issue? I need to compare both issues now to make sure the patch posted here really contains the thing proposed from over there. As soon as stuff is changed in the other issue, we need to fix stuff up here. But what if this gets to RTBC first and is accidentally committed while we change stuff in the other issue?
IMO this "race" just creates headaches, confusion and duplicate work for patch creators and reviewers.
Comment #25
jibranI won't mind this headache but I do mind postponing a complete issue on other incomplete issue.
@klausi if this is done then can we RTBC this. Thank you. :-)
Comment #26
klausiAs posted in #2759879: Additional assertions for WebAssert and AssertLegacyTrait, part 2 the logic in the new legacy assert methods need test coverage.
Comment #27
claudiu.cristeaOK, this is after #2759879: Additional assertions for WebAssert and AssertLegacyTrait, part 2.
Comment #28
Eric_A CreditAttribution: Eric_A commentedCould we please keep any testing framework changes (8.1.x eligible?) out of this 8.2.x color.module issue?
Comment #29
claudiu.cristeaok.
Comment #30
dawehnerIs documentation really a testing framework change? Well whatever
Comment #31
xjmI've queued a heap of PHP7/Postgres test runs, to make sure this isn't impacted by the same problem as #2737805: Convert web tests to browser tests for forum module. (The forum test fails were by far the most disruptive recently, but I have also noticed similar fails in other BTB tests so I want to rule out that something similar might happen here.)
Comment #33
xjmOkay, looks like this conversion does not introduce any fails at least above 3 Kelvin. Committed b561f51 and pushed to 8.2.x. Thanks!
Going forward, let's please stop doing individual module conversions and do larger chunks at once. See #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits and https://www.drupal.org/core/scope#incomplete.
Comment #34
claudiu.cristeaHm... It's not possible for all. For example the Book conversion required to move one test as Javascript test #2757007: Convert all book web tests to BrowserTestBase.