Improve the remove of SendResponseListener #3936

Closed
wants to merge 1 commit into from
View
9 library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php
@@ -14,7 +14,6 @@
use Zend\Http\Request as HttpRequest;
use Zend\Mvc\Application;
use Zend\Mvc\MvcEvent;
-use Zend\Mvc\SendResponseListener;
use Zend\Stdlib\Exception\LogicException;
use Zend\Stdlib\Parameters;
use Zend\Stdlib\ResponseInterface;
@@ -147,12 +146,8 @@ public function getApplication()
$this->application = Application::init($appConfig);
$events = $this->application->getEventManager();
- foreach ($events->getListeners(MvcEvent::EVENT_FINISH) as $listener) {
- $callback = $listener->getCallback();
- if (is_array($callback) && $callback[0] instanceof SendResponseListener) {
- $events->detach($listener);
- }
- }
+ $events->detach($this->application->getServiceManager()->get('SendResponseListener'));
+
return $this->application;
}