Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
18 Oct 2016 at 19:00 UTC
Updated:
6 May 2017 at 08:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dawehnerComment #4
jhedstromAre all the unused
usestatements needed?Comment #5
dawehnerNot at all.
Comment #6
klausiI would avoid adding yet another test base class.
Why is it such a problem that we add the most common APIs to BrowserTestBase itself? Code separation we can do with traits, so BrowserTestBase growing in code size is not an argument. For discoverability I think BrowserTestBase should have a rich API with many helper methods.
If we convert the old Simpletests to LegacyBrowserTestBase then we need to convert them another time to BrowserTestBase after that. I think it just creates more work and confusion.
But anyway, I also don't care too much about this, so feel free to proceed if others agree.
Comment #7
tim.plunkettThis is much better than polluting BTB itself!
Comment #8
dawehnerIf we agree on that general approach, we should still somehow make it easily possible to find those additional traits. Maybe use some common name like "*TestHelperTrait",
or just somehow use
@ingroup test_helper_traitto make them easy to find?Comment #9
dawehner@klausi @tim.plunkett @jhedstrom
So do we basically agree on RTBCing this issue?
Comment #10
klausiNot sure that we need this now. In #2814047: BrowserTestBase should implement AssertMailTrait for backwards compatibility we decided that we can do the conversion script from old Simpletests to BrowserTestBase in a way that we add the required trait if the method gets called. That was successful for AssertMailTrait::getMails() in #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits.
If we agree that approach is good enough then we can close this as won't fix.
Comment #11
dawehner@klausi
I would totally agree with you, unless we want to make it as straightforward as possible for custom/contrib code. Not sure they'll be able to use the script?
Comment #12
klausiHaving that class in core means we have to maintain it, which means we have to test it although we don't use it in core. I don't see the benefit of doing that work. Probably some input from contrib maintainers would be good at this point, would they use LegacyBrowserTestBase or would they convert straight to BrowserTestBase directly?
@tim.plunkett how would you like to convert your tests?
Comment #13
tim.plunkettWithin a single subsystem or module, I'd prefer to individually convert each test to the latest and greatest approach. An intermediate step would just mean extra work.
But in terms of the best or most efficient way to remove the old WebTestBase, a legacy base class makes sense.
Absolutely we should strive to keep BTB clean.
Comment #14
klausiJust to clarify: we will not remove WebTestBase in the Drupal 8 release cycle, ever. So Drupal 8 contrib converting their tests is optional. Simpletest will be supported forever in Drupal 8.
In Drupal 9 we will remove WebTestBase, but of course we will also remove any LegacyBrowserTestBase. So if a d8 contrib module converted to LegacyBrowserTestBase it will have to convert again to BrowserTestBase in Drupal 9.
Comment #15
dawehnerSo what do we do about that, should we add one or not?
Comment #16
dawehnerMeh :)
Comment #18
lendudeI agree with this.
Adding a trait to a specific test class when a method is needed is pretty trivial, and finding the right trait isn't all that hard either.
So my 2cts, I'd not add this.
Comment #19
dawehnerI agree now, I believe. We see that we can make progress without it.