3
* @copyright © 2007, 2008, 2009 Intrahealth International, Inc.
4
* This File is part of I2CE
6
* I2CE is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
* @author Mark A. Hershberger <mhershberger@intrahealth.org>
26
* pull in static classes.
28
require_once 'PHPUnit/Framework.php';
30
error_reporting(E_ALL | E_STRICT);
32
function IGNORE_ERROR($errno, $errstr, $errfile, $errline)
36
foreach(debug_backtrace() as $f => $l) {
37
if(array_key_exists("class", $l)) {
38
if($l['class'] === 'MDB2' &&
39
$l['function'] === 'raiseError') {
47
if(class_exists("I2CE")) {
48
I2CE::raiseError("$errstr (at line $errline in $errfile)", $errno);
53
set_error_handler('IGNORE_ERROR');
55
define("TOP_DIR", dirname(dirname(dirname(__FILE__))));
56
ini_set('include_path',ini_get('include_path').":".TOP_DIR."/lib");
57
require_once 'I2CE.php';
58
require_once 'I2CE_MagicData.php';
61
* Configurator Test class -- handles dependencies and such.
64
class I2CE_Framework extends PHPUnit_Framework_TestCase {
65
static protected function data_dir($class) {
66
return TOP_DIR."/tests/$class/";
69
static protected $errors = array();
70
static protected $not_errors = array();
71
protected function setUp() {
72
self::$errors = array();
73
self::$not_errors = array();
74
I2CE::pushErrorHandler(array(__CLASS__, "errorHandler"));
77
protected function tearDown() {
78
I2CE_MagicData::tearDown();
79
I2CE::resetFileSearch();
80
I2CE::popErrorHandler(array(__CLASS__, "errorHandler"));
83
static public function errorHandler($base, $str, $type) {
84
if($type === E_ERROR) {
85
array_push(self::$errors, $str);
88
array_push(self::$not_errors, $str);
90
# Just keep them quiet for now.
93
static protected function addClassPath($path) {
94
ini_set('include_path',ini_get('include_path').":".$path);
98
if(get_class($this) === __CLASS__) {
107
# c-default-style: bsd
108
# indent-tabs-mode: nil