Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
#1890878: Add modular authentication system, including Http Basic; deprecate global $user replaced global $user by \Drupal::request()->attributes->get('account'). However, this attribute is not available during Simpletest tests.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2032553-11.patch | 4.7 KB | pwolanin |
#11 | 2032553-9-11.increment.txt | 2.99 KB | pwolanin |
#9 | 2032553-9.patch | 1.71 KB | pwolanin |
#1 | drupal_2032553_1.patch | 1.37 KB | Xano |
Comments
Comment #1
XanoComment #2
corvus_ch CreditAttribution: corvus_ch commentedI would use the $GLOBALS['user'] notation here but I wonder where the
global $user
gets populated during simpletest. For we consider this deprecated, we should try to replace it instead of use it.Comment #3
XanoUnitTestBase might not have to be altered. In that case, why is TestBase::rebuildContainer() only used by WebTestBase and nothing else? Also, should DrupalUnitTestBase also be patched to provide a request account?
Comment #4
XanoThis happens in TestBase::prepareEnvironment().
Comment #6
pwolanin CreditAttribution: pwolanin commentedfixing title
Comment #7
pwolanin CreditAttribution: pwolanin commentedWe are seeing other test failures due to this as we try to switch to using the _account attribute in patches
Comment #8
pwolanin CreditAttribution: pwolanin commentedbumping priority - this is blocking attempts to move access checks to use $account->hasPermission() in other patches
Comment #9
pwolanin CreditAttribution: pwolanin commentedTrying again with _account
Comment #11
pwolanin CreditAttribution: pwolanin commentedEntityReferenceSelectionAccessTest fails - the fix is the same as already done for patch in #26: #2004086: The Request service must be synthetic
Comment #12
pwolanin CreditAttribution: pwolanin commentedComment #13
dawehnerWe might could add a @todo how to remove the global user properly (i guess we want to always store the current global user on the test object?)
Comment #14
xjm@dawehner You mean #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user']?
Comment #15
webchickLooks straight-forward enough. Committed and pushed to 8.x. Thanks!
Comment #16
webchickAhem. And by that I meant... "no longer applies." :P
Comment #17
webchickugh. ignore me.