Problem/Motivation
Developers are finding the new PHPUnit based kernel tests somewhat confusing. How declaring modules to enable via the $modules variable is counter intuitive, and is a cause of confusing even with some experienced developers.
Proposed resolution
At @berdir's suggestion, I'm fixing the language in KernelTestBase.php to make it more clear how this works.
Remaining tasks
Review the submitted patch :-)
Also, possibly back port this, since this is also a problem in 8.1.x.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
Torenware commentedComment #3
Torenware commentedComment #4
dawehnerSure why not. Can we add the same documentation to BrowserTestBase as well?
Comment #5
Torenware commentedYeah, I'd be willing to do that. Any comments on the wording as changed?
Comment #6
jhodgdonThanks for making this issue and patch! Seems like a good idea to clarify it, in all of the base classes that have this member variable.
Wording... hm...
I think rather than adding extra wording to what is there and adding a code sample, we should instead fix the unclear wording that was there.
I suggest replacing the entire paragraph that starts with "Test classes..." with the following, or something like this:
The test runner will merge the $modules lists from this class, the class it extends, and so on up the class hierarchy. So, it is not necessary to include modules in your list that a parent class has already declared.
And I don't really think we need an @code example?
Comment #7
Torenware commented@jhodgdon -- I've changed the language accordingly.
@dawehner -- Funny thing: there's no
public static $modulesdeclared in BrowserTestBase. So there's no comment to fix. But... looking at the code, I see the following:So my sense is that there really ought to be a $modules class variable declared in BrowserTestBase, even if there isn't one now. And it should probably have a similar comment to the one used in KernelTestBase.
That said, it probably needs a slightly different comment than KernelTestBase. So what do you want me to do here?
Comment #8
dawehnerOh yeah, well then let's add the same kind of documentation.
Comment #9
jhodgdonAgreed, we should add the $modules variable, and docs, to BrowserTestBase. I just checked and it is not inheriting $modules from any base class. I don't see why it would need a different comment from the one in KernelTestBase?
Setting to Needs Work for that.
Comment #10
dawehnerMe neither, cool
Comment #11
dawehnerI totally agree that the new comment makes it easier to understand.
Comment #12
joachim commentedThe comma after 'So' isn't needed. In fact, the 'So' isn't either.
Comment #13
dawehnerThe brits are coming, let's run :)
Comment #14
jhodgdonFair enough, let's remove the "So".
Comment #15
pepegarciag commentedAdd DrupalCampES tag
Comment #16
pepegarciag commentedJust remove the "So".
Comment #17
pepegarciag commentedComment #18
pushpinderchauhan commentedLooks good to me. Setting this ti RTBC.
Comment #19
alexpottCommitted 7338397 and pushed to 8.1.x and 8.2.x. Thanks!
Comment #20
alexpottAlso we need a followup for BrowserTestBase.
Comment #21
dawehnerSee #2713765: Document BrowserTestBase::$modules
Comment #22
abarrioCongratulations @pepegarciag. When you will go to start with this, please call me.