/** * setup the things that every app has * * it is up to the mainLoop() of the different types of app * to setup the rest (user, page, and theme) */ public static function init() { self::$browsers = new Browser_Manager(); self::$users = new User_Manager(); self::$routes = new Routing_Manager(); self::$pages = new Page_Manager(); self::$themes = new Theme_Manager(); self::$debug = new Debug_Manager(); // disable debugging if we are unit testing if (defined('UNIT_TEST') && UNIT_TEST) { self::$debug->setEnabled(false); } // with the general environment loaded, we can now load // the modules that are app-specific self::$request = new App_Request(); self::$response = new App_Response(); self::$conditions = new App_Conditions(); }
/** * @covers \Phix\App::routes */ public function testRoutes() { $routes = array(array('GET', '/', function () { })); $app = new App(); $this->assertSame(array(), $app->routes()); $app->routes($routes); $this->assertArrayHasKey('GET', $app->routes()); $ret = $app->routes(array(), true); $this->assertSame(array(), $app->routes()); $this->assertEquals($ret, $app); }