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

Commit

Permalink
#24 - Failing test case demonstrating the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Oct 15, 2015
1 parent b4e46d5 commit 9c140e1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/ZeffMuTest/AppFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,44 @@ function (EventInterface $e) {

$app->run();
}

/**
* @group #24
*
* @requires PHP 5.4
*/
public function testControllerPluginsAreCorrectlyInjectedInFactories()
{
$helper = $this->getMock(
'Zend\Mvc\Controller\Plugin\PluginInterface',
['setController', 'getController', '__invoke']
);

$request = new Request();
$app = App::init();
/* @var $plugins \Zend\ServiceManager\AbstractPluginManager */
$plugins = $app->getServiceManager()->get('ControllerPluginManager');

$request->setUri('http://localhost/something');
$app->getMvcEvent()->setRequest($request);

$plugins->setService('foo', $helper);

$app->route('/something', function () {
$this->foo('bar');
});

$helper->expects(self::once())->method('__invoke')->with('bar');

// overriding send response listener
$app->getEventManager()->attach(
MvcEvent::EVENT_FINISH,
function (EventInterface $e) {
$e->stopPropagation();
},
1000
);

$app->run();
}
}

0 comments on commit 9c140e1

Please sign in to comment.