Problem/Motivation
When using a testing.services.yml file in the parent site, currently any kernelTest will fatal because KernelTestBase will try to copy this file to a non-existent location
Proposed resolution
Copy it to the right location and fix a silly concatenation while we are at it.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2927476-4.patch | 1.01 KB | lendude |
| #2 | 2927476-2.patch | 2.54 KB | lendude |
| #2 | 2927476-2-TEST_ONLY.patch | 1.53 KB | lendude |
Comments
Comment #2
lendudeHere is a test and a fix.
Not happy with the test since this writes to the parent site, but since that is what we are trying to test I don't see a way around that. Better ideas are welcome.
Comment #3
tstoecklerYes, this makes sense. For context, this is how
$this->siteDirectoryis set up:so it ends up being something like
vfs://root/sites/simpletest/123456789. Since$this->rootis the actual (host) Drupal root URL the prepending doesn't make any sense.Regarding test coverage: Yeah, I don't think we can get away with modifying anything in
sites/defaultas part of a test. If people actually use that feature and happen to runKernelTestBaseTestwe would either be deleting their test overrides or the test would fail due to permission issues. Neither is desirable, IMO. So let's just not test this. The fact that this explicitly involves the host/parent system is also the reason why this is currently completely untested. So far no one has been able to think of a way to test this in isolation...Also, I found #2927487: \Drupal\KernelTests\KernelTestBase::bootEnvironment() has some dead code while reviewing this.
Comment #4
lendude@tstoeckler thanks for the feedback.
Ok so just the fix then. The test-only should still illustrate the problem even if it's just a one off thing.
Comment #6
tstoecklerThanks, perfect!
To make up for the lack of automated test coverage, here's the output my shell where I verified the correctness of the patch:
Comment #7
tstoecklerBTW, also found #2927487: \Drupal\KernelTests\KernelTestBase::bootEnvironment() has some dead code when testing this locally.
Comment #9
lendudeUnrelated fail
Comment #12
xjmThanks for the test patch and the verification in #6; those demonstrate the bug and fix nicely. I agree we should not futz with
sites/defaultin a test. (Reminds my of my first core issue... #1212992: Prevent tests from deleting main installation's tables when parent::setUp() is not called.)The silly concatenation fix is out of scope and it did actually distract me from the fix, because I spent a couple minutes trying to figure out why that also needed a change before I saw it was just a silly out-of-scope cleanup. But I will let it slide just this once. :P
Committed to 8.5.x, and cherry-picked to 8.4.x as a test-only bugfix. Thanks!
Comment #13
lendudeSorry @xjm! Won't try to sneak out-of-scope stuff in next time :)
Thanks for committing!