示例#1
0
 /**
  * @covers Opl_ErrorHandler::display
  */
 public function testOutputCancellationOnUnmatchedException()
 {
     ob_start();
     ob_start();
     echo 'XYZ';
     $handler = new Opl_ErrorHandler();
     // This exception will not be matched
     $handler->display(new Opl_Exception('Foo'));
     $out = ob_get_clean();
     if (strpos($out, 'XYZ') === false) {
         $this->fail('The earlier string XYZ was cancelled by the exception handler.');
     }
     return true;
 }
示例#2
0
        }
        $view->results = $results;
    }
}
// end GeneralForm;
try {
    $tpl = new Opt_Class();
    $opf = new Opf_Class($tpl);
    $tpl->sourceDir = './templates/';
    $tpl->compileDir = './templates_c/';
    $tpl->compileMode = Opt_Class::CM_REBUILD;
    $tpl->stripWhitespaces = false;
    $tpl->gzipCompression = false;
    $tpl->register(Opt_Class::PHP_FUNCTION, 'dump', 'var_dump');
    $tpl->setup();
    $translate = new Opc_Translate(new Opc_Translate_Adapter_Ini(array('directory' => './lang/')));
    $translate->setLanguage('en');
    $opf->setTranslationInterface($translate);
    $view = new Opt_View('situation_5.tpl');
    $view->devFile = 'situation_5.php';
    $form = new GeneralForm('form5');
    $form->setView($view);
    $form->execute();
    $output = new Opt_Output_Http();
    $output->render($view);
} catch (Exception $e) {
    var_dump($e);
} catch (Opl_Exception $exception) {
    $handler = new Opl_ErrorHandler();
    $handler->display($exception);
}
示例#3
0
 /**
  * Registers the OPL error handling port in OPL error handler together
  * with the necessary informers.
  *
  * @static
  * @param Opl_ErrorHandler $handler The OPL error handler
  */
 public static function register(Opl_ErrorHandler $handler)
 {
     $handler->addPort(new Opl_ErrorHandler_Port());
 }