protected function setUp() { define('SERVER_SCRIPT', 'unittest'); \Slim\Environment::mock(); \Application\Bootstrap::init(); \Library\SFacebook::init(); }
<?php use Application\App; use Application\Controllers\Error; error_reporting(E_ALL | E_STRICT); require __DIR__ . '/../vendor/autoload.php'; try { $app = \Application\Bootstrap::init(); $app->run(); } catch (\Exception $e) { if (!IS_PRODUCTION) { die($e->getMessage()); } else { syslog(LOG_ERR, $e->getMessage()); echo 'Sorry, something went wrong. We are working on this'; die; } }
} 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.'); } if (file_exists($vendorPath . '/autoload.php')) { include $vendorPath . '/autoload.php'; } include $zf2Path . '/Zend/Loader/AutoloaderFactory.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::init();