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

Use v2-compatible EventManager instantiation when lazy-loading #73

Merged
merged 1 commit into from
Feb 12, 2016

Conversation

weierophinney
Copy link
Member

Per #71, getEventManager(), when lazy-loading an EventManager, was using the v3 syntax, instead of v2-compatible syntax, causing identifiers to break under v2 (as they are now injected with a SharedEventManager instance instead).

This patch:

  • Adds a compatiblity test to ensure that the usage works on both v2 and v3.
  • Fixes the lazy-loading code to instantiate and then inject identifiers.

This also addresses #72, as the problem presented in that report is due to the fact that the SharedEventManager was injected as an identifier, and identifiers are only allowed to be strings or integers.

Per zendframework#71, `getEventManager()`, when lazy-loading an `EventManager`, was using the
v3 syntax, instead of v2-compatible syntax, causing identifiers to break under
v2 (as they are now injected with a `SharedEventManager` instance instead).

This patch:

- Adds a compatiblity test to ensure that the usage works on both v2 and v3.
- Fixes the lazy-loading code to instantiate and then inject identifiers.
/**
* @depends testCanLazyLoadEventManager
*/
public function testLazyLoadedEventManagerIsInjectedProperlyWithDefaultIdentifiers(EventManager $events)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be sure, I'd also add an @coversNothing test that triggers an event (any event) on the event manager and on its attached shared event manager (integration test)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, missed this comment!

That said, the other tests are already testing triggering of events, and that works between both versions. The difference, however, is that those inject an EM instance (or mock) to do so, so they're primarily testing that the correct calls are made. I did, however, have issues crop up in testing yesterday when completing the migration patch due to compatibility issues, which I was able to fix. I'll see if I can come up with an additional test to be on the safe-side, though.

@weierophinney weierophinney merged commit ddbd850 into zendframework:master Feb 12, 2016
weierophinney added a commit that referenced this pull request Feb 12, 2016
weierophinney added a commit that referenced this pull request Feb 12, 2016
weierophinney added a commit that referenced this pull request Feb 12, 2016
@weierophinney weierophinney deleted the hotfix/71 branch February 12, 2016 16:30
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.

3 participants