function __setupApp($serverName = null) { if (empty($serverName) && defined($_SERVER["SERVER_NAME"])) { $serverName = $_SERVER["SERVER_NAME"]; } $config = new Config(); $config->setProtected('basePath', BASE_PATH); setCommonConfig($config, $serverName); if (function_exists('setUniqueConfig')) { setUniqueConfig($config, $serverName); } return new \App\Application($config); }
protected function setUp() { $config = new Config(); $config->setProtected('basePath', BASE_PATH); setCommonConfig($config); setUniqueConfig($config); $dbConfig = $config->getProtected('dbConfig'); if ($dbConfig['type'] == 'mysql') { Application::setupRedBean("mysql:host={$dbConfig['host']};dbname={$dbConfig['dbname']};port={$dbConfig['port']}", $dbConfig['user'], $dbConfig['password'], $config->getProtected('isDevMode')); } elseif ($dbConfig['type'] == 'sqlite') { Application::setupRedBean("sqlite:{$dbConfig['dbname']}", $dbConfig['user'], $dbConfig['password'], $config->getProtected('isDevMode')); } R::freeze(false); R::nuke(); R::freeze($this->frozen); $this->app = __setupApp(); /** $http Mock Http object. */ $http = $this->getMock('Skully\\Core\\Http'); $http->expects($this->any())->method('redirect')->will($this->returnCallback('stubRedirect')); $this->app->setHttp($http); }