Permalink
Browse files

test case for additional events

  • Loading branch information...
1 parent 2a16b00 commit 93b5784f178210bcd836ccd9a34b6999b82f6c95 @radnan committed Jan 9, 2013
Showing with 19 additions and 14 deletions.
  1. +19 −14 tests/ZendTest/Mvc/View/DefaultRendereringStrategyTest.php
@@ -56,23 +56,27 @@ public function setUp()
public function testAttachesRendererAtExpectedPriority()
{
- $events = new EventManager();
- $events->attachAggregate($this->strategy);
- $listeners = $events->getListeners(MvcEvent::EVENT_RENDER);
-
- $expectedCallback = array($this->strategy, 'render');
- $expectedPriority = -10000;
- $found = false;
- foreach ($listeners as $listener) {
- $callback = $listener->getCallback();
- if ($callback === $expectedCallback) {
- if ($listener->getMetadatum('priority') == $expectedPriority) {
- $found = true;
- break;
+ $evm = new EventManager();
+ $evm->attachAggregate($this->strategy);
+ $events = array(MvcEvent::EVENT_RENDER, MvcEvent::EVENT_RENDER_ERROR);
+
+ foreach ($events as $event) {
+ $listeners = $evm->getListeners($event);
+
+ $expectedCallback = array($this->strategy, 'render');
+ $expectedPriority = -10000;
+ $found = false;
+ foreach ($listeners as $listener) {
+ $callback = $listener->getCallback();
+ if ($callback === $expectedCallback) {
+ if ($listener->getMetadatum('priority') == $expectedPriority) {
+ $found = true;
+ break;
+ }
}
}
+ $this->assertTrue($found, 'Renderer not found');
}
- $this->assertTrue($found, 'Renderer not found');
}
public function testCanDetachListenersFromEventManager()
@@ -132,6 +136,7 @@ public function testTriggersRenderErrorEventInCaseOfRenderingException()
$resolver = new TemplateMapResolver();
$resolver->add('exception', __DIR__ . '/_files/exception.phtml');
$this->renderer->setResolver($resolver);
+
$strategy = new PhpRendererStrategy($this->renderer);
$this->view->getEventManager()->attach($strategy);

0 comments on commit 93b5784

Please sign in to comment.