Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
statistics.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2014 at 16:25 UTC
Updated:
25 Dec 2014 at 15:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hussainwebComment #2
mile23Not sure where
$this->authUsercomes from. Clearly there's a$this->auth_user, but that should be from a superclass if it's not declared in the original. But it's not in the superclass either.As it is, the value is only ever referenced in
setUp(), and creates the auth user as a side-effect which persists through the test method. I turned it into a local variable just now, and the test passes.Other than that, looks good.
Comment #3
mile23Comment #4
hussainweb@Mile23: I couldn't quite understand what you say in #2. I added the property because it was used in the setUp method. You are quite right in saying that it is only used there and we can just change it to a local variable, but this is also true in countless other places in other modules. Should we change to local variables all over?
Actually, I think I would agree to changing such instances to local variables all over the code base (to keep things cleaner and predictable) but I didn't think for them to be in the scope of this issue.
Comment #5
mile23Yes, changing all of them would be outside the scope of this issue, but it's also true that the reference to $this->auth_user in setUp() is weird and maybe buggy. Changing $this->auth_user might *also* be out of scope...
I'd say your change is probably the best of these options though. I'll RTBC and let's find out what a maintainer thinks....
The patch in #1 refactors class-level properties from under_score to camelCase as the coding standards demand.
I know this because I applied the patch, ran my own coding standards review with netbeansdrupalcomposed, and poked through all the test classes to find camel case and underscore violations.
There are some ambiguities in regard to
StatisticsLoggingTest->adminUserandStatisticsTestBase->blockingUser, which exist as their underscore versions in the setUp() method, but aren't defined in the class.@hussainweb added these as properties, which might be out of scope, overkill, or just the right thing. I vote for it.
Comment #6
alexpottCommitted 2775f31 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation for to the issue summary.