/** * @see PHPUnit_Framework_TestCase::setUp() */ protected function setUp() { $oServiceManager = \TranslatorToolsTest\Bootstrap::getServiceManager(); $this->configuration = \Zend\Stdlib\ArrayUtils::merge($oServiceManager->get('Config'), include __DIR__ . '/../configuration.php'); $bAllowOverride = $oServiceManager->getAllowOverride(); if (!$bAllowOverride) { $oServiceManager->setAllowOverride(true); } $oServiceManager->setService('Config', $this->configuration)->setAllowOverride($bAllowOverride); $this->controller = new \TranslatorTools\Controller\ToolsController(); $this->request = new \Zend\Http\Request(); $this->routeMatch = new \Zend\Mvc\Router\RouteMatch(array('controller' => 'tools')); $this->event = new \Zend\Mvc\MvcEvent(); $this->event->setRouter(\Zend\Mvc\Router\Http\TreeRouteStack::factory(isset($this->configuration['router']) ? $this->configuration['router'] : array()))->setRouteMatch($this->routeMatch); $this->controller->setEvent($this->event); $this->controller->setServiceLocator($oServiceManager); }
/** * @see PHPUnit_Framework_TestCase::setUp() */ protected function setUp() { $oServiceManager = \TranslatorToolsTest\Bootstrap::getServiceManager(); //Define service $this->service = $oServiceManager->get('TranslatorToolsService'); }