Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
views.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2020 at 05:18 UTC
Updated:
17 Nov 2020 at 10:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shetpooja04 commentedCommit ID: 1ae0ed87
Link: https://git.drupalcode.org/project/drupal/-/commit/1ae0ed87961a92967314d3c289d25656058f54cc
File: core/modules/views/src/Tests/Handler/FieldEntityOperationsTest.php Line: 47
For Issue: https://www.drupal.org/project/drupal/issues/2476563 the variable was unused here
Please review
Comment #3
jijojoseph_zyxware commentedThanks for researching this, I agree with your findings that we don't need this variable.
Patch applied cleanly.
RTBC!!!
Comment #4
catchIf $admin_user isn't used, I don't think we need to create it at all.
Comment #5
jijojoseph_zyxware commented@catch You're Right. I have Created new patch.
Comment #6
jijojoseph_zyxware commentedComment #7
adhershmnair commentedI have reviewed Patch #5 and applied cleanly.
$admin_useris not used anywhere and also we don't want to create the user.Thanks @jijojoseph_zyxware for the patch.
RTBC!!!
Comment #8
catchSorry looking at this in context I think there's another issue - we should be logging in as $admin_user instead of $this->rootUser for the test - then the variable will be used and we'll be testing what was intended. If the test fails with that change, we might need to adjust the permission (although it looks OK).
Comment #9
anmolgoyal74 commentedAddressed #8.
I think we need to update permissions as well.
Comment #12
sanjayk commentedWorking on it.
Comment #13
sanjayk commentedAs mentioned #8 added another permission and also changed '\Drupal\user\UserInterface' with '\Drupal\Core\Session\AccountInterface'.
Comment #14
lendudeDo we really need to do this in setUp() it's not like the is re-used anywhere? Why not just add the permission and do $this->drupalLogin($admin_user)?
Comment #15
paulocsI'll work on it.
Comment #16
kapilv commentedHear an updated patch.
Comment #17
paulocs@kapilkumar0324 if you are working in an issue you should assign it to your self, otherwise two people are working in the same issue and spend time with no reason (in that case I was working on it).
In my opinion it makes no sense to login in the setup() and I think @Lendude mentioned it in comment #14.
Another point is that now
$adminUserin$this->drupalLogin($adminUser);is undefined so patch needs work.For me it makes no sense to login in setup() but it is okay to create the user in setup().
I hide the files wrongly.
I'll provide a patch for it.
Comment #18
paulocsPatch and interdiff.
Comment #20
paulocsComment #21
sulfikar_s commentedHello, @paulocs your patch applied cleanly. Also, it satisfies the requirements as in #8 by @catch and #14 by @Lendude.
Also your explanation seems correct about the
$this->drupalLogin($adminUser);as it needs to be changed.Thanks for the patch!
RTBC
changing the status to RTBC.
Comment #22
sulfikar_s commentedComment #23
lendudeThis still seems needlessly complicated adding the user in setUp. Much smaller change to just use the existing variable. ¯\_(ツ)_/¯
Comment #24
paulocsLooks good too.
Comment #27
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!