? Success
Referenced as Related to: # 4750 # 4766 # 4799 # 4800 # 4803 # 4806 # 4808 # 4822 # 4835

User tests: Successful: Unsuccessful:

avatar Kubik-Rubik
Kubik-Rubik
16 Oct 2014

This first PR introduces a wrapper class for the JUserHelper class to get rid of the static methods to improve the testing basis of the code for our PHPUnit tests!

It should be used as a template for other classes (JPluginHelper etc.) which also have to be considered.

The static methods (and the wrappers) will be removed completely in Joomla! 4.x.

avatar Kubik-Rubik Kubik-Rubik - open - 16 Oct 2014
avatar jissues-bot jissues-bot - change - 16 Oct 2014
Labels Added: ?
avatar Kubik-Rubik Kubik-Rubik - change - 16 Oct 2014
Category Libraries Unit Tests
avatar wilsonge
wilsonge - comment - 16 Oct 2014

What's the benefit of having an external wrapper class for this? I mean I get unit testing benefits but generally the principle of helper classes is that they should be static methods. If they aren't going to be statics then imo they should just be more methods in JUser. I really don't see the use of them being this standalone class you have to inject into JUser

avatar Kubik-Rubik
Kubik-Rubik - comment - 16 Oct 2014

@wilsonge Please read this: https://github.com/sebastianbergmann/de-legacy-fy#wrapping-a-static-api-class

We need this wrapper in Joomla! 3.x for backward compatibility, it will be removed in Joomla! 4.x.

avatar mbabker
mbabker - comment - 16 Oct 2014

In practice, Joomla has always used static helpers. In theory, it isn't necessarily the best way to go about things.

avatar Kubik-Rubik
Kubik-Rubik - comment - 16 Oct 2014

Travis failed because we need also to adjust the loader to handle the new introduced "helperwrapper" classes.

loader.php - change in the function import

// Handle special case for helper classes.
if ($class == 'helper' || $class == 'helperwrapper')
avatar mbabker
mbabker - comment - 16 Oct 2014

If you create a new folder named helper in the libraries/joomla/user folder then rename the file to wrapper.php it'll work. The autoloader expects a new folder at each capital letter with the final one being the file name reference.

avatar Kubik-Rubik
Kubik-Rubik - comment - 16 Oct 2014

@mbabker Thanks! I wanted to adjust the loader but your solution is just perfect.

avatar roland-d
roland-d - comment - 17 Oct 2014

@test This PR works as expected, I have tested:

  • Creating a new user
  • Activating the new user
  • Modify the user profile
  • Remove the user
  • Change the user password

All works as expected.

avatar roland-d roland-d - test_item - 17 Oct 2014 - Tested successfully
avatar javigomez
javigomez - comment - 17 Oct 2014

@test this PR works as expected, I have tested:

  • activate/deactivate a user
  • Creating a new user
  • Changing password and login with new pass
  • add/remove user from Usergroup
avatar javigomez javigomez - change - 17 Oct 2014
Labels Added: ?
avatar brianteeman
brianteeman - comment - 17 Oct 2014

Moving to RTC

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4717.

avatar brianteeman brianteeman - change - 17 Oct 2014
Status Pending Ready to Commit
avatar Kubik-Rubik
Kubik-Rubik - comment - 17 Oct 2014

@sebastianbergmann Can you please take a look on our implementation? Thanks!

avatar sebastianbergmann
sebastianbergmann - comment - 17 Oct 2014

Looks good to me, @Kubik-Rubik.

avatar Kubik-Rubik
Kubik-Rubik - comment - 17 Oct 2014
avatar mbabker
mbabker - comment - 17 Oct 2014

Merged to 3.4-dev

avatar mbabker mbabker - close - 17 Oct 2014
avatar zero-24 zero-24 - close - 17 Oct 2014
avatar mbabker mbabker - change - 17 Oct 2014
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2014-10-17 09:36:20
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment