Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing: Adding application and menu objects to component routers #4848

Closed
wants to merge 3 commits into from

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Oct 19, 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

@pollen8
Copy link
Contributor

pollen8 commented Nov 14, 2014

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

@chivitli
Copy link
Contributor

Tested, all seems good.

@mbabker mbabker added this to the Joomla! 3.4.0 milestone Nov 22, 2014
@mbabker mbabker closed this Nov 22, 2014
@Hackwar Hackwar deleted the app_menu_in_router2 branch November 22, 2014 07:02
@Hackwar
Copy link
Member Author

Hackwar commented Nov 22, 2014

You guys trying to make me happy? 😄

pmorrisarctg added a commit to ArcTechnologyGroup/joomla-cms that referenced this pull request Nov 26, 2014
staging

# By Michael Babker (143) and others
# Via infograf768 (131) and others
* 'staging' of https://github.com/joomla/joomla-cms: (1128 commits)
  Fixed typo introduced on PR joomla#4308
  Fixed missing space
  Correcting comments
  [fix joomla#5173] JRouterInstallation::build() strict standards
  trim the author and created_by_alias before saving
  Remove all \r\n
  Update en-GB.plg_system_debug.ini
  JRouterInstallation::parse() made compatible with the interface (Fix
joomla#5173)
  Clean up non-printable characters.
  Fixed creationDate
  Fixes Author and Copyright info for Editor - None
  Routing: Implementing an interface for component router rules (Fix
joomla#4849)
  Routing: Adding application and menu objects to component routers (Fix
joomla#4848)
  Fixing JGithub repository contents api (Fix joomla#5067)
  [bug] Protostar template doesn't work with component links in SEF.
Fixes joomla#5085
  Fix undefined variable in Article Model
  ... use the right variable, dummy.
  fix the codemirror display bug, happens when codemirror is initialized
in a hidden element.
  Use the created_by_alias in the author meta tag. This is consistent
with how author name is show elsewhere.
  [fix] Broken groups management by joomla#4308
  ...

Conflicts:
	installation/sql/sqlazure/sample_blog.sql
	installation/sql/sqlazure/sample_testing.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants