/** * CCProfiler::check tests */ public function test_enable_disable() { $checks = count(CCProfiler::data()); CCProfiler::check('check 1'); $this->assertEquals(count(CCProfiler::data()), $checks + 1); CCProfiler::disable(); CCProfiler::check('check 2'); $this->assertEquals(count(CCProfiler::data()), $checks + 1); CCProfiler::enable(); CCProfiler::check('check 3'); $this->assertEquals(count(CCProfiler::data()), $checks + 2); }
/** * Environment wake * This is an environment wake they get called if your running * the application in a special environment like: * wake_production * wake_phpunit * wake_test * * @return void | CCResponse */ public static function wake_development() { CCProfiler::check('App::development - Application finished wake events.'); }
$paths = (require CCROOT . 'boot/paths' . EXT); /* *--------------------------------------------------------------- * the direcotries *--------------------------------------------------------------- * * Here are the module directories defined. * @ToDo: move them to the classes that use that direcotries. * that way the you could subclass a class and define * a custom direcotry. */ $directories = array('controller' => 'controllers/', 'language' => 'language/', 'class' => 'classes/', 'console' => 'console/', 'config' => 'config/', 'view' => 'views/', 'test' => 'tests/'); /* *--------------------------------------------------------------- * wake CCF *--------------------------------------------------------------- * * Lets require the ClanCatsFramework resources */ require $paths['core'] . 'wake' . EXT; /* *--------------------------------------------------------------- * wake the application *--------------------------------------------------------------- * * Lets wake the main application. */ ClanCats::wake_app('App'); // at this point the app has completet its own boot CCProfiler::check("CCF - App completed.");
/** * send response * means printing the response and setting the headers if set * * @param bool $headers * @return void */ public function send($headers = false) { if ($headers && headers_sent() && !CLI) { throw new CCException("CCResponse::send - cannot send header, header has already been send."); } if ($headers) { // status header header(CCIn::server('SERVER_PROTOCOL') . ' ' . $this->_status . ' ' . CCResponse::$messages[$this->_status]); // check if content type is already set if (!isset($this->_header['Content-Type'])) { $this->header('Content-Type', 'text/html; charset=' . ClanCats::$config->get('charset', 'utf-8')); } $this->header('X-Powered-By', 'ClanCatsFramework version: ' . ClanCats::VERSION); // set headers foreach ($this->_header as $key => $content) { header($key . ': ' . $content); } } // profiler CCProfiler::check('CCResponse - sending response'); // print the body echo CCEvent::pass('response.output', $this->body()); }
*--------------------------------------------------------------- * Require the application map *--------------------------------------------------------------- * * The application map can contain additional path information */ if (file_exists(APPPATH . 'map' . EXT)) { require APPPATH . 'map' . EXT; } /* *--------------------------------------------------------------- * composer / vendor *--------------------------------------------------------------- * * After ccf is done with its own initialisation we implement the * composers vendor autoloader. */ require_once VENDORPATH . "autoload" . EXT; // at this point vendor autoloader is registered CCProfiler::check("CCF - Vendro autoloader registered."); /* *--------------------------------------------------------------- * installed ships *--------------------------------------------------------------- * * Load and wake all installed ships. */ CCOrbit::enter_installed_ships(); // all done CCProfiler::check("CCF - All runtime ships entered the Orbit.");
/** * Add a ship * this loads the ship loader file * * @param string $path * @return bool */ public static function enter($path) { if (!is_array($path)) { $path = array($path); } foreach ($path as $ship) { // load ship at path $ship = CCOrbit_Ship::create($ship); if (array_key_exists($ship->name, static::$ships)) { throw new CCException("CCOrbit::enter - {$ship->name} ship already entered."); } if ($ship->wake !== false) { $ship->event($ship->wake); } CCProfiler::check("CCOrbit - ship {$ship->name} launched."); // add to our loaded ships static::$ships[$ship->name] = $ship; } }