? Success

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
19 Oct 2014

Routers in Joomla should be testable in the future with unittests. Right now, they heavily depend on JFactory and some not-so-nice code constructs to work. In order to introduce dependency injection, this PR hands over the application and the menu to the component routers. This means that you can inject fake application objects and menus into the router during testing. At the same time, component routers can build lookup tables once when they are instantiated and can get their input through these 2 objects.

This is backwards compatible, since additional arguments for a method/constructor are simply ignored by PHP and since we didn't have any arguments up to this point for the constructor, this has no effect so far.

In the future, the application router should get something similar in order to make the whole process testable. For the moment, the Singletons are still used.

Testing instructions: Set the error_reporting in Joomlas global configuration to maximum, check any errors/notices/warnings that appear, apply the change and then see that no new errors/notices/warnings showed up.

This is a new, cleaned up PR that relates to #4714.

This was made possible through the generous donation of the people mentioned in the following link via an Indiegogo campaign: http://joomlager.de/crowdfunding/5-contributors

avatar Hackwar Hackwar - open - 19 Oct 2014
avatar jissues-bot jissues-bot - change - 19 Oct 2014
Labels Added: ?
avatar pollen8
pollen8 - comment - 14 Nov 2014

seems good here.Massive +1 for DI of the JApp object etc

avatar chivitli
chivitli - comment - 20 Nov 2014

Tested, all seems good.

avatar Hackwar Hackwar - change - 20 Nov 2014
The description was changed
Status Pending Ready to Commit
avatar mbabker mbabker - change - 22 Nov 2014
The description was changed
Status Ready to Commit Fixed in Code Base
avatar mbabker mbabker - close - 22 Nov 2014
avatar mbabker mbabker - change - 22 Nov 2014
Closed_Date 0000-00-00 00:00:00 2014-11-22 02:49:52
avatar Hackwar
Hackwar - comment - 22 Nov 2014

You guys trying to make me happy? :smile:

Add a Comment

Login with GitHub to post a comment