ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
9 class ilUnitUtil
10 {
14  public static function performInitialisation()
15  {
19  global $ilErr;
20 
21  define('IL_PHPUNIT_TEST', true);
22 
23  session_id('phpunittest');
24  $_SESSION = array();
25 
26  include 'Services/PHPUnit/config/cfg.phpunit.php';
27 
28  include_once 'Services/Context/classes/class.ilContext.php';
30 
31  include_once('Services/Init/classes/class.ilInitialisation.php');
33  ilInitialisation::initUserAccount();
34 
35  $ilUnitUtil = new self();
36  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
37  PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
38  }
39 
44  public function errorHandler($a_error_obj)
45  {
46  echo "Error occured: ".get_class($a_error_obj)."\n";
47  try
48  {
49  throw new Exception("dummy");
50  }
51  catch(Exception $e)
52  {
53  echo($e->getTraceAsString()."\n\n");
54  }
55  exit();
56  }
57 }