? ? ? Success

User tests: Successful: Unsuccessful:

avatar izharaazmi
izharaazmi
23 Jan 2016

Introduction

This PR introduces a new method JApplicationCms::isClient($identifier) as a substitute for isSite and isAdmin methods. Hence, remove usage of descendant class reference in the JApplication (legacy) and JApplicationCms for better OO structure and support more extensibility.

Since the current implementation essentially assumes its two subclasses JApplicationSite and JApplicationAdministrator which should be avoided as much possible.

This PR also enables more subclasses derived from JApplicationCms to make use of this method. Such as in the Installation app of the Joomla installer package, we currently cannot perform a test something like $app->isInstallation();.
But this PR allows us to do the test like $app->isClient('installation');

Feature Testing

Since this PR does not change any existing usage of existing methods the cms should not behave any different.

Run the following code in frontend, backend and installation applications respectively and match the output.

// Get instance of current application.
$app = JFactory::getApplication();

// Should give bool(true) in frontend, bool(false) otherwise.
var_dump($app->isClient('site'));
// var_dump($app->isClient(0)); 

// Should give bool(true) in backend, bool(false) otherwise.
var_dump($app->isClient('administrator'));
// var_dump($app->isClient(1));

// Should give bool(true) in Joomla installer, bool(false) otherwise.
var_dump($app->isClient('installation'));
// var_dump($app->isClient(2));

EDIT: Removed support for client id (integer) with 84163c5.

avatar izharaazmi izharaazmi - open - 23 Jan 2016
avatar izharaazmi izharaazmi - change - 23 Jan 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Jan 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Jan 2016
Labels Added: ?
avatar mbabker
mbabker - comment - 23 Jan 2016

1) I'd leave legacy JApplication alone, it's going away and already out of use in the CMS.
2) Personally, I would not accept mixed argument types on the new method. I'd either use the client ID or the client name, the latter would be more easily recognized. Methods that accept mixed parameter types (unless it's something acting as a data store like JObject or the Registry classes) looks like a code smell, you're essentially building two methods into one.

avatar izharaazmi
izharaazmi - comment - 23 Jan 2016

@mbabker Well, then do you suggest to drop the integer argument support? Or split into two methods for each?
For a while I also thought to name that new method as just is($identifier) like $app->is('site') but not sure if it good. What do you suggest?

avatar mbabker
mbabker - comment - 23 Jan 2016

I'd drop the integer and leave the name. There are very few places that actually refer to the client IDs throughout the code base; the name is more favored.

avatar izharaazmi
izharaazmi - comment - 23 Jan 2016

Exactly, I wonder why do we even support IDs, why not just deprecate without a substitute!

And, the PR... your suggestion sounds good to me. Should I make this changes or wait for more inputs from other fellow members?

avatar brianteeman brianteeman - change - 22 Mar 2016
Labels
avatar brianteeman brianteeman - change - 22 Mar 2016
Category Libraries
avatar izharaazmi
izharaazmi - comment - 12 May 2016

Can we make this a part of 3.6 release? Somebody available to test this please?

avatar brianteeman brianteeman - change - 12 Jul 2016
Category Libraries Libraries Unit Tests
avatar brianteeman brianteeman - change - 12 Jul 2016
Labels
avatar kevinscheithauer kevinscheithauer - test_item - 2 Aug 2016 - Tested successfully
avatar kevinscheithauer
kevinscheithauer - comment - 2 Aug 2016

I have tested this item successfully on 84163c5

I have tested this issue @icampus PBF with the proposed change and it works as its supposed to. I followed the suggested steps and IsClient() returned the correct value in each case.


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

avatar brianteeman brianteeman - change - 2 Aug 2016
Category Libraries Unit Tests Feature Request Libraries Unit Tests
avatar brianteeman brianteeman - change - 2 Aug 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 2 Aug 2016
Labels
avatar mcanuste mcanuste - test_item - 2 Aug 2016 - Tested successfully
avatar mcanuste
mcanuste - comment - 2 Aug 2016

I have tested this item successfully on 84163c5

I have followed the suggested steps and outputs are correct for each case.
@icampus PBF


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

avatar brianteeman brianteeman - change - 2 Aug 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 2 Aug 2016

RTC


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

avatar joomla-cms-bot joomla-cms-bot - change - 2 Aug 2016
Labels Added: ?
avatar rdeutz
rdeutz - comment - 1 Oct 2016

@izharaazmi could you have a look at the conflicts and resolve them, thanks!

avatar izharaazmi
izharaazmi - comment - 1 Oct 2016

@rdeutz I have merged 3.7.x branch into it resolving the conflicts. Please check.

avatar rdeutz rdeutz - change - 1 Oct 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-10-01 12:03:21
Closed_By rdeutz
avatar rdeutz rdeutz - close - 1 Oct 2016
avatar rdeutz rdeutz - merge - 1 Oct 2016
avatar zero-24 zero-24 - close - 1 Oct 2016
avatar zero-24 zero-24 - change - 3 Oct 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment