Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
user system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Jan 2018 at 21:33 UTC
Updated:
19 Feb 2018 at 14:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tim.plunkettComment #3
larowlanassuming bot agrees
Comment #4
jonathan1055 commentedThanks for raising this. The Rules issue which shows examples of the test failures is #2936553: Rules kernel tests fail with "Creating default object from empty value"
I will test this core patch locally but it looks fine at first glance.
Comment #5
jonathan1055 commentedI've tested #2 locally on 8.5.x with Rules dev and the failing tests now pass. So I am also happy with the RTBC.
Comment #7
fagoWould be great to get this committed to 8.5 and 8.6.
Comment #8
jonathan1055 commentedYes, this is causing Rules to fail testing at 8.5 and 8.6. To show how this core patch fixes the Rules tests I have created a github branch which has a modfied .travis.yml file to conditionally apply the patch from #2 above when running at 8.5.x or above. I used the following:
The github branch is https://github.com/jonathan1055/rules/tree/2936642-context-warning
n.b. this branch also has the test fix from #2936679-3: Autocomplete test needs values for "Default Revision" flag
The Travis test job is https://travis-ci.org/jonathan1055/rules/builds/330574666
Comment #9
larowlanComment #10
catchIt's good that this fixes the Rules tests, but is there a reason we cant add core test coverage for this?
Comment #11
jonathan1055 commentedI'm sure a test could be added to Core to check the context handler for anon users, but I don't know how to do that. This ia a bug that was introduced in #2671964: ContextHandler cannot validate constraints and is blocking development on Rules because the tests do not pass. If the only reason for not committing this correction is a lack of Core test coverage then can we find someone who does know how to write the test?
Comment #12
tim.plunkettThis error can never be triggered on a real Drupal site, unless you manage to delete the anonymous user account.
The only way to run into this problem is by writing a unit test that makes incorrect assumptions about the user system.
No functional test (like any of those that test the condition system) could ever reproduce this bug.
I'd just as soon won't fix this and everyone should update their tests.
But I think it'd be nice of us to commit this simple fix.
Comment #13
tim.plunkettJust to clarify my comment:
On a real site, $this->userStorage->load(0) still returns a valid user account, one with the anonymous role.
Comment #15
larowlanAgree, this is a test-only edge case and we're blocking contrib here.
Committed as c3ebbc4 and pushed to 8.6.x. Thanks!
Cherry-picked as dd5bae6 and pushed to 8.5.x
Comment #18
jonathan1055 commentedJust for the record, the six failing Rules tests were:
In #12 tim.plunkett said
As this is now a closed issue discussion can continue on #2936553: Rules kernel tests fail with "Creating default object from empty value"