API page: https://api.drupal.org/api/drupal/core%21tests%21Drupal%21KernelTests%21...
The docs here leave much unanswered:
> The module/hook system is functional and operates on a fixed module list. Additional modules needed in a test may be loaded and added to the fixed module list.
What defines the fixed module list?
> the modules are only loaded, but not installed
What does that actually mean? Outside of testing, there is no concept of a module being loaded but not installed, so this needs to be clearly defined.
> Modules have to be installed manually, if needed.
How do you do that?
Also, the @see links are broken.
Comment | File | Size | Author |
---|---|---|---|
#17 | 2898373-17.patch | 6.19 KB | jofitz |
#11 | interdiff.txt | 4.66 KB | Mile23 |
#11 | 2898373_11.patch | 6.43 KB | Mile23 |
#8 | interdiff.txt | 2.55 KB | Mile23 |
#8 | 2898373_8.patch | 5.34 KB | Mile23 |
Comments
Comment #2
dawehnerComment #3
Mile23Here's the docblock I came up with:
Comment #4
joachim CreditAttribution: joachim as a volunteer commented> No modules can be fully installed.
Is it not the case that if you do installConfig() and installEntitySchema() you get the equivalent of the module being installed?
Comment #5
Lendude@Mile23 that looks much better!
Some additional thoughts I had:
I would definitely mention installConfig() and installEntitySchema(), even if it's just a @see.
And I agree that 'No modules can be fully installed.' might cause a little confusion. I would just leave that out. The previous two paragraph make it pretty clear what you get, whether or not that, combined with installConfig() and installEntitySchema(), is equivalent to a full install probably depends on the module.
Comment #6
joachim CreditAttribution: joachim as a volunteer commented> combined with installConfig() and installEntitySchema(), is equivalent to a full install probably depends on the module.
It would be good to say that for most modules, those together are sufficient (if that is actually the case!)
Comment #8
Mile23This is a documentation-only change and also a testing improvement, so it scores the 8.4.x-alpha double bonus.
Added info about installConfig() and installEntitySchema(), with a suggestion that you might try BrowserTestBase, too.
Comment #10
dawehnerShould we also have some sentence mentioning when this class should actually be used? "The KernelTestBase should be extended when you want to test integrations between components in a module, or anything related with storing/loading data." Better suggestions are welcomed.
At least a @see
::installSchema
would be helpful, I thinkComment #11
Mile23#10.1:
Okay.... But if we go too much further down this path we get into an argument about whether we should use KTB as a replacement for everything this says: https://www.drupal.org/docs/8/phpunit/unit-testing-more-complicated-drup... :-)
#10.2:
Done.
Setting back to 8.4.x because: docs-only and testing.
Comment #12
dawehnerThank you @Mile23
I think we can iterate on this issue forever ...
Comment #13
joachim CreditAttribution: joachim as a volunteer commentedAgreed -- this patch is a huge improvement! Let's get this in and we can think about adding more detail in the future.
Comment #14
Gábor HojtsyLooks like a great improvement! Thanks!
As per our backport policy this would need to be committed to 8.5.x first and then backported/cherry-picked. Unfortunately this patch does not apply to 8.5.x.
Comment #15
Gábor HojtsyAdjusted credits.
Comment #16
Gábor HojtsyComment #17
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Comment #18
dawehnerThank you @Jo Fitzgerald!
Comment #21
larowlanCommitted as d034b44 and pushed to 8.5.x.
Cherry-picked as 14aec6b and pushed to 8.4.x.