Skip to content

Commit

Permalink
pull FlashMessenger container from flashMessenger plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Nov 21, 2016
1 parent 28aeaa0 commit 43b34ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function flashMessengerHandler(EventInterface $e)
return;
}

$flash = $controller->plugin('flashMessenger');
$container = new Container('FlashMessenger');
$flash = $controller->plugin('flashMessenger');
$container = $flash->getContainer();
$reCreateFlash = $container->getArrayCopy();

foreach ($reCreateFlash as $key => $row) {
Expand Down
8 changes: 5 additions & 3 deletions test/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testOnBootstrap($hasMessages)
$sharedEvmAttach->will(function() use ($module, $e, $hasMessages, $abstractActionController, $flashMessenger, $pluginManager) {
$abstractActionController->getPluginManager()->willReturn($pluginManager)->shouldBeCalled();
$pluginManager->has('flashMessenger')->willReturn(true)->shouldBeCalled();

if ($hasMessages) {
$namespace = 'flash';
$message = 'a message';
Expand All @@ -89,6 +89,8 @@ public function testOnBootstrap($hasMessages)
$container = new Container('FlashMessenger');
$container->offsetSet($namespace, $splQueue);

$flashMessenger->getContainer()->willReturn($container)
->shouldBeCalled();
$flashMessenger->setNamespace($namespace)
->willReturn($flashMessenger)
->shouldBeCalled();
Expand Down Expand Up @@ -121,7 +123,7 @@ public function testOnBootstrap($hasMessages)

$this->module->onBootstrap($e->reveal());
}

public function testOnBootstrapWithDoesntHasFlashMessenger()
{
$e = $this->prophesize('Zend\Mvc\MvcEvent');
Expand Down Expand Up @@ -161,7 +163,7 @@ public function testOnBootstrapWithDoesntHasFlashMessenger()

$e->getApplication()
->willReturn($application)
->shouldBeCalled();
->shouldBeCalled();

$this->module->onBootstrap($e->reveal());
}
Expand Down

0 comments on commit 43b34ed

Please sign in to comment.