ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilUnitUtil.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10{
14 public static function performInitialisation()
15 {
19 global $ilErr;
20
21 if (!defined('IL_PHPUNIT_TEST')) {
22 define('IL_PHPUNIT_TEST', true);
23 }
24
25 session_id('phpunittest');
26 $_SESSION = array();
27
28 include 'Services/PHPUnit/config/cfg.phpunit.php';
29
30 include_once 'Services/Context/classes/class.ilContext.php';
32
33 include_once('Services/Init/classes/class.ilInitialisation.php');
35 $GLOBALS['DIC']['ilAuthSession']->setUserId($_SESSION["AccountId"]);
37
38 $ilUnitUtil = new self();
39 $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
40 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
41 }
42
47 public function errorHandler($a_error_obj)
48 {
49 echo "Error occured: " . get_class($a_error_obj) . "\n";
50 try {
51 throw new Exception("dummy");
52 } catch (Exception $e) {
53 echo($e->getTraceAsString() . "\n\n");
54 }
55 exit();
56 }
57}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
static setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
Definition: PEAR.php:337
const CONTEXT_UNITTEST
static init($a_type)
Init context by type.
static initUserAccount()
Init user with current account id.
Utilities for Unit Testing.
errorHandler($a_error_obj)
exit
Definition: login.php:29
$ilErr
Definition: raiseError.php:18