Esempio n. 1
0
 public function testMainWithChainedRequests()
 {
     $routerMock = $this->getMock('zibo\\core\\router\\Router', array('getRequest', 'getRoutes', 'getAliases'));
     $routerMockCall = $routerMock->expects($this->once());
     $routerMockCall->method('getRequest');
     $routerMockCall->will($this->returnValue(new Request('', '', 'zibo\\core\\TestController', 'chainAction')));
     $zibo = new Zibo($this->getBrowserMock(), $this->getConfigIOMock());
     $zibo->setRouter($routerMock);
     $zibo->setDispatcher(new GenericDispatcher($zibo, new ObjectFactory()));
     $zibo->main();
     $this->assertEquals(array('chain', 'index'), TestController::$actions);
 }
Esempio n. 2
0
 * Check Bootstrap.php to modify the base configuration
 */
use zibo\core\Zibo;
use Exception;
try {
    // include the bootstrap to initialize error handling, autoloader and
    // dependencies. it should also create $fileBrowser, $configIO and $environment
    require_once 'bootstrap.php';
    // create an instance of Zibo
    $zibo = new Zibo($fileBrowser, $configIO);
    $zibo->setEnvironment($environment);
    $zibo->setDefaultTimeZone('Europe/Brussels');
    $zibo->setDefaultLocale(array('en_IE.utf8', 'en_IE', 'en'));
    // run Zibo
    $zibo->bootModules();
    $zibo->main();
} catch (Exception $exception) {
    // uncaught exception
    $class = get_class($exception);
    $message = $exception->getMessage();
    $trace = $exception->getTraceAsString();
    // try to log the exception
    try {
        if (isset($zibo)) {
            $zibo->triggerEvent(Zibo::EVENT_LOG, $class . ($message ? ': ' . $message : ''), $trace);
        }
    } catch (Exception $e) {
    }
    $title = 'Uncaught exception (' . $class . ')' . ($message ? ': ' . $message : '');
    if (php_sapi_name() == 'cli') {
        echo "\n" . $title . "\n\n" . $trace;