protected function setUp()
 {
     ini_set('error_reporting', E_ALL ^ E_USER_DEPRECATED);
     Bootstrap::init();
     $this->setApplicationConfig(include __DIR__ . '/../../TestConfig.php.dist');
     parent::setUp();
     $serviceManager = $this->getApplicationServiceLocator();
     $serviceManager->setAllowOverride(true);
     // mock the adapter, driver, and parts
     $mockResult = $this->getMock('Zend\\Db\\Adapter\\Driver\\ResultInterface');
     $mockStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult));
     $mockConnection = $this->getMock('Zend\\Db\\Adapter\\Driver\\ConnectionInterface');
     $mockDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement));
     $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection));
     $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?'));
     // setup mock adapter
     $this->mockAdapter = $this->getMock('Zend\\Db\\Adapter\\Adapter', null, [$mockDriver, new TrustingMysqlPlatform()]);
     $serviceManager->setService('Zend\\Db\\Adapter\\Adapter', $this->mockAdapter);
 }
        chdir($rootPath);
    }
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    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::chroot();
Bootstrap::init();
 protected function setUp()
 {
     ini_set('error_reporting', E_ALL ^ E_USER_DEPRECATED);
     Bootstrap::init();
     $this->serviceManager = Bootstrap::getServiceManager();
 }