public function setUp() { $this->initDatabaseAdapter(); $this->sm = Bootstrap::getServiceManager(); $this->sm->setAllowOverride(true); $this->sm->setService('INNN\\Entity\\Event', new \INNN\Entity\Event()); $this->sm->setService('Zend\\Db\\Adapter\\Adapter', $this->dbAdapter); }
public function setUp() { $this->sm = Bootstrap::getServiceManager(); $this->sm->setAllowOverride(true); $servicesToMock = array('Zend\\Db\\Adapter\\Adapter' => 'Zend\\Db\\Adapter\\Adapter', 'Core\\Service\\Tick' => 'Core\\Service\\Tick', 'logger' => 'Zend\\Log\\Logger', 'INNN\\Table\\EventTable' => 'INNN\\Table\\EventTable', 'INNN\\Table\\EventView' => 'INNN\\Table\\EventView', 'User\\Table\\UserTable' => 'User\\Table\\UserTable'); foreach ($servicesToMock as $key => $serviceName) { $this->sm->setService($key, $this->getMockBuilder($serviceName)->disableOriginalConstructor()->getMock()); } }
} elseif (is_dir($vendorPath . '/ZF2/library')) { $zf2Path = $vendorPath . '/ZF2/library'; } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) { $zf2Path = $vendorPath . '/zendframework/zendframework/library'; } } if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__)))); } /** * @param string $path */ protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init();
public function setUp() { $this->sm = Bootstrap::getServiceManager(); #$this->sm->setAllowOverride(true); }