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

Fixes #246 : Forward plugin should detach problem listeners #247

Merged
merged 4 commits into from
Nov 24, 2017

Conversation

nathanjosiah
Copy link

Fixes #246


foreach ($classArray as $class) {
if ($currentCallback instanceof $class) {
// Pass $currentEvent; when using zend-eventmanager v2,
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this comment, it was only relevant for v2.

@@ -237,6 +238,35 @@ function ($e) {}
$this->assertEquals(['content' => 'ZendTest\Mvc\Controller\TestAsset\ForwardController::testAction'], $result);
}

public function testProblemListenersAreDetachedAndReattachedWhenPluginDispatchsRequestedController()
Copy link
Member

Choose a reason for hiding this comment

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

No assertion or expected exception?

Copy link
Author

Choose a reason for hiding this comment

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

@froschdesign I'm not sure what the ZF policy or practice is for this type of assertion but in this case, the assertion is implied in the mock method invocation expectation:

$sharedEvents->expects($this->once())->method('detach')

If the method isn't invoked with the expected arguments, the test will fail with an exception. What is the preferred way of testing something like this? Maybe a test spy that monitors called methods and then the assertion can be the method was called?

Copy link
Author

Choose a reason for hiding this comment

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

@froschdesign Just bumping this, it's been 3 months and I'd love to start using ZF3. This issue is the only thing holding us back.

I'm happy to make whatever change to the test. As my comment above says, my assertion is implied in the mock once invocation expectation. Would you prefer I change this to an explicit test spy? I'm not sure what the ZF test expectation would be for this use case.

@froschdesign froschdesign added this to the 3.1.1 milestone Jul 20, 2017
@Xerkus
Copy link
Member

Xerkus commented Nov 17, 2017

Test failure is unrelated and fixed in #260

@Xerkus Xerkus merged commit 705ba86 into zendframework:master Nov 24, 2017
Xerkus added a commit that referenced this pull request Nov 24, 2017
Xerkus added a commit that referenced this pull request Nov 24, 2017
@nathanjosiah nathanjosiah deleted the fix-246 branch November 28, 2017 16:45
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