? ? Success

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
14 Apr 2017

Pull Request for Issue # .

Summary of Changes

This PR makes several improvements to controller classes as explained below:

  1. Add $option property to Controller class. We will now get $option from $config or input, not guessing it from class name like in none-namespace class anymore

  2. Correct behavior or getName() method:

  • For base component controller, it will return name controller (for example, contact, banners, modules)
  • For sub-controller class, it will return the name of that sub-controller. For example, BannersControllerBanner will return banner.
  1. Implement getModel method for admin controller. With this method, we can delete most of blank getModel method in admin controllers (I deleted some in this PR for demo purpose)

  2. Some code clean up, docblock, codestyle for easy navigating between method/class in modern IDE like PHPStorm

  3. Pass $option and $name property to Model and View creation code so that the Model and View class won't have to guess these important properties from class name anymore

Testing Instructions

  1. Install Joomla 4 from 4.0-dev branch or nightly build
  2. Apply patch
  3. Try to navigate to random pages in frontend and backend, make sure it still works as expected
  4. Try to publish/unpublish banners for example, make sure it is working as expected

Documentation Changes Required

  1. getName() method of Controller return name of actual controller (not always return name of component like before)

  2. Note the getModel method of Admin controller implemented.

avatar joomdonation joomdonation - open - 14 Apr 2017
avatar joomdonation joomdonation - change - 14 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 14 Apr 2017
Category Administration com_banners com_categories com_content Libraries
2e27cf1 14 Apr 2017 avatar joomdonation CS
avatar joomdonation joomdonation - change - 14 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 14 Apr 2017
Category Administration com_banners com_categories com_content Libraries Administration com_banners com_categories com_content Libraries Unit Tests
avatar joomdonation joomdonation - change - 14 Apr 2017
Labels Added: ?
avatar joomdonation
joomdonation - comment - 14 Apr 2017

Travis still false here, but it comes from JPaginationTest and not related to this PR. I did, however, had to change some tests in JControllerFormTest. Those tests are written for none namespace classes and might not be correct anymore now:

  1. As mentioned in PR description, we are now getting option directly from config or input, not guessing from class name anymore. So for those tests, I added option to config array of controller constructor

  2. For controller class name MincesControllerMince, in a Joomla component, I assume it is a sub-controller and comes from the request has task=mince.task_name. With the code I implemented in getInstance() method https://github.com/joomdonation/joomla-cms/blob/721dcc9d14265b8a2a1591f4753503912637223d/libraries/src/CMS/Controller/Controller.php#L296 , we will have name=mince passed to $config array. That's why I pass name=mince to the controller constructor of the test

avatar joomdonation joomdonation - change - 14 Apr 2017
The description was changed
avatar joomdonation joomdonation - edited - 14 Apr 2017
avatar rjcf18 rjcf18 - test_item - 15 Apr 2017 - Tested successfully
avatar rjcf18
rjcf18 - comment - 15 Apr 2017

I have tested this item successfully on 1871161

I have navigated through several list and edit views on the backend in com_users (users, notes, fields), com_menus (menus, menu items), com_banners(banners, categories, clients, tracks), com_content (articles, categories, fields, field groups, featured articles), published and unpublished several banners and several articles and have found no problems whatsoever. Also went through several pages and modules on the frontend and everything seems to be fine.

System information

Joomla! 4.0.0-dev
OS: Linux Deepin 15.3
Kernel: 4.4.0-3-deepin-amd64
Google Chrome: 56.0.2924.76 (64 bit)
PHP: 7.0.12-2
MySQLi 5.7.15-1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15301.
avatar joomdonation
joomdonation - comment - 15 Apr 2017

Many thanks for testing @rjcf18

avatar joomla-cms-bot joomla-cms-bot - change - 25 Apr 2017
Category Administration com_banners com_categories com_content Libraries Unit Tests Administration com_content Libraries Unit Tests
avatar joomdonation
joomdonation - comment - 8 May 2017

@wilsonge If you still have time today, please help reviewing this one, too.

avatar brianteeman brianteeman - change - 8 Jun 2017
Milestone Added:
avatar brianteeman brianteeman - change - 8 Jun 2017
Milestone Added:
avatar joomdonation joomdonation - change - 29 Sep 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-09-29 13:25:30
Closed_By joomdonation
avatar joomdonation joomdonation - close - 29 Sep 2017

Add a Comment

Login with GitHub to post a comment