User tests: Successful: Unsuccessful:
I find my self many times overriding the constructor in my plugins simply to add a reference to $this->app
and $this->db
for easy access to the application object and the database object within my plugin methods. The proposed update takes care of this by adding a bit of magic to the JPlugin constructor. It checks to see if the app
and db
properties exist within your plugin class, and if they do (and are null) it will set them to JFactory::getApplication()
and JFactory::getDbo()
automatically.
It's a minor change, but it makes J! programming that easier.
Feature Tracker Item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31205
Simple and useful
Thanks for adding the UT's for this Michael.
Is this good to merge then?
I hope so.
From everything I see, this seems good to merge. Does it need more testing?
It's in Ready for Review status, meaning it's waiting for a(nother) PLT member to review it and accept or reject. It can't be me due to contributing code for this.
Thanks for clarifying. Hopefully it will be merged before it encounters
merge conflicts and needs to be redone. It's a nice improvement.
Best,
Matt Thomas
Founder betweenbrain http://betweenbrain.com/™
Lead Developer Construct Template Development
Frameworkhttp://construct-framework.com/
Phone: 203.632.9322
Twitter: @betweenbrain
Github: https://github.com/betweenbrain
On Mon, Jul 8, 2013 at 9:42 AM, Michael Babker notifications@github.comwrote:
It's in Ready for Review status, meaning it's waiting for a(nother) PLT
member to review it and accept or reject. It can't be me due to
contributing code for this.—
Reply to this email directly or view it on GitHub#1321 (comment)
.
Status changed to accepted on the tracker, so hopefully that means it'll make it for 3.1.2!
+1 The code is very straightforward and actually makes plugins (more) testable without introducing any backwards compatibility issues.