Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Ensure navigation helpers are injected with application service container #50

Merged
merged 6 commits into from
Feb 22, 2016

Conversation

weierophinney
Copy link
Member

With the update to 2.6.0, the navigation helpers no longer formally implement ServiceLocatorAwareInterface, though they continue to implement the methods. An initializer was added to the navigation-specific PluginManager to mimic the behavior, but was written incorrectly.

This patch:

  • adds a test to demonstrate the behavior expected.
  • updates the initializer to work correctly under both v2 and v3.

Fixes #49

- Adds a test to ensure that the parent container is injected into
  navigation helpers by the initializer created in the navigation
  PluginManager constructor, and fixes the code to work correctly.
- for forwards compatiblity
- Modified the condition for pulling the parent locator to test against
  the v3 `configure` method instead; `getServiceLocator()` also exists
  in v3, but emits a deprecation notice.
- Modified the test for the behavior to work under both versions. The
  expected behavior is the same, given the same configuration.
Adds code to the `getPluginManager()` implementation to ensure that if a
service locator is composed, it is used to inject a lazy-instantiated
navigation plugin manager. This should fix the last lingering issues as
reported in zendframework#49.
Some tests are injecting the plugin manager as the service locator, when, in
fact, the two instances should be discretely different. This patch ensures the
tests continue to pass by updating `setServiceLocator()` to test if the instance
is a plugin manager. If it is, it pulls the parent context and uses that
instead.
@weierophinney weierophinney merged commit 2888591 into zendframework:master Feb 22, 2016
weierophinney added a commit that referenced this pull request Feb 22, 2016
weierophinney added a commit that referenced this pull request Feb 22, 2016
weierophinney added a commit that referenced this pull request Feb 22, 2016
@weierophinney weierophinney deleted the hotfix/49 branch February 22, 2016 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant