Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
history.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2013 at 08:31 UTC
Updated:
29 Jul 2014 at 22:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
m1r1k commentedHere is the patch:
Comment #3
kscheirerI think we need Drupal::currentUser() to get in first, then we can take care of this.
Comment #4
andypostNow we should use current_user service
Comment #5
m1r1k commentedWe have such weird stuff here. How should it be handled by "current_user" service?
Also looks like History has wrong tests, I will post more info here.
Comment #6
andypostyep, the tests should be fixed too see #2062097-10: Remove calls to deprecated global $user in theme.inc
Comment #7
joelpittetre-rolled with currentUser service.
Jumping on here because this fixes registry_rebuild error messages in drush:) Thanks for creating this and the meta!
I had to revert the $GLOBAL['user'] for simple test to pass, and seems that is an issue, see note at the bottom of the change request. @see https://drupal.org/node/2032447
Comment #9
joelpittet#7: 2061927-7-global-user-history.patch queued for re-testing.
Comment #11
joelpittetHmm, so UI tests pass though testbot cli tests fail. Anybody pointers?
Comment #12
m1r1k commentedI found 3 points last time:
Also I haven't had errors in Drupal\rdf\Tests\StandardProfileTest before ...
Comment #13
joelpittet@m1r1k thanks, yeah seems getting access to the service in the command line is failing. I'm sure all the failures are related. The web UI run on the tests isn't having much of a problem.
The changes were from the 'new' change request so if you look at the interdiff, not much changed.
Comment #14
joelpittetre-roll with #2053489: Standardize on \Drupal throughout core
I expect this to fail tests again because nothing has really changed to fix it and it fails on the CLI locally but the Web UI passes with no issues on the tests.
Comment #16
larowlan#14: 2061927-14-global-user-history.patch queued for re-testing.
Comment #18
andypostcore/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php: $GLOBALS['user'] = $account;this should be fixed first
Also related #2105123-18: Add a currentUser() method to plugin base classes that need it that was rolled back
Comment #19
joelpittetRemoved $GLOBALS['user'] as mentioned in #18. It's not needed because the user is set with the line above in $this->drupalLogin($account);
Comment #21
andypostSuppose $account = \Drupal::currentUser(); is much better
somehow this is needed!?
Comment #22
joelpittet@andypost have a look at those lines you pointed out again. #21
1) The first one says 'if' there is no $account use the $global $user. So if $account isn't passed through, look for the default on the request.
2) The $GLOBALS['user'] is set in drupalLogin as I noted in #19
Comment #23
andypostyep.
1) let's clean-up $user variable
2) the tests are broken without this change... not sure why
Comment #24
joelpittet@andypost sorry if there is a misunderstanding but
Have a look at this issue that could solve why this meta with such simple changes is falling flat.
#1858196: [meta] Leverage Symfony Session components
Comment #25
joelpittet#19: 2061927-18-global-user-history.patch queued for re-testing.
Comment #26.0
(not verified) commentedlinking meta
Comment #27
joelpittet19: 2061927-18-global-user-history.patch queued for re-testing.
Comment #29
internetdevels commentedLets see.
Comment #31
joelpittetEven though the fails didn't change, I like the changes:)
There seems to be issues with how sessions are created.
Comment #32
joelpittet29: drupal-removeglobaluserfromhistorymodule-2061927-29.patch queued for re-testing.
Comment #34
joelpittet@InternetDevels thanks, that looks nicer and I found one more.
Comment #36
joelpittetSo this should pass all tests. I removed the conversion within the test that was failing.
This is because of this in the Change Record
I'm not sure if this needs a follow-up for that on the meta?
Comment #37
joelpittetComment #38
areke commentedI didn't find anymore $user variables that needed to be removed, so this looks good.
Comment #39
joelpittet@areke thanks for RTBCing this. I'll leave it as so because I think it should go in as is because of that Change Record but I would like to get an answer on what to do with those simpletests(see interdiff from last patch). Maybe I can ask Crell.
Comment #40
joelpittetMoved the test $GLOBALS['user'] removal to a separate issue:
#2150857: Remove references to global $user in History module tests. and updated issue summary.
Comment #41
webchickCommitted and pushed to 8.x. Thanks!