~oh-dev/openhealth/phit-tools

« back to all changes in this revision

Viewing changes to ihris-suite/lib/i2ce/tests/lib/I2CE_Framework_TestClass.php

  • Committer: litlfred at ibiblio
  • Date: 2009-10-26 13:55:16 UTC
  • Revision ID: litlfred@ibiblio.org-20091026135516-7er0260tad01febt
ihris suite updated to 4.0.1 pre-release...
follows that did not get added on the last attempt did this time... the problem is that bzr does not like to include branches in a sub-directory even if you add them in which 
  is how ihris-suite/lib/* was structed.  so i had to move ihris-suite/lib/*/.bzr to ihris-suite/lib/*/.bzr_dir to trick it
the site will now succesfully install.  have not attempted change the root drive letter yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * @copyright © 2007, 2008, 2009 Intrahealth International, Inc.
 
4
 * This File is part of I2CE
 
5
 *
 
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.
 
10
 * 
 
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.
 
15
 * 
 
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/>.
 
18
 * @package I2CE
 
19
 * @subpackage Core
 
20
 * @author Mark A. Hershberger <mhershberger@intrahealth.org>
 
21
 * @version 2.1
 
22
 * @access public
 
23
 */
 
24
 
 
25
/**
 
26
 * pull in static classes.
 
27
 */
 
28
require_once 'PHPUnit/Framework.php';
 
29
 
 
30
error_reporting(E_ALL | E_STRICT);
 
31
 
 
32
function IGNORE_ERROR($errno, $errstr, $errfile, $errline)
 
33
{
 
34
    switch ($errno) {
 
35
    case 2048:
 
36
        foreach(debug_backtrace() as $f => $l) {
 
37
            if(array_key_exists("class", $l)) {
 
38
                if($l['class']    === 'MDB2' &&
 
39
                   $l['function'] === 'raiseError') {
 
40
                    return TRUE;
 
41
                }
 
42
            }
 
43
        }
 
44
        break;
 
45
    }
 
46
 
 
47
    if(class_exists("I2CE")) {
 
48
        I2CE::raiseError("$errstr (at line $errline in $errfile)", $errno);
 
49
        return TRUE;
 
50
    }
 
51
    return FALSE;
 
52
}
 
53
set_error_handler('IGNORE_ERROR');
 
54
 
 
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';
 
59
 
 
60
/**
 
61
 * Configurator Test class -- handles dependencies and such.
 
62
 * @package I2CE
 
63
 */
 
64
class I2CE_Framework extends PHPUnit_Framework_TestCase {
 
65
    static protected function data_dir($class) {
 
66
        return TOP_DIR."/tests/$class/";
 
67
    }
 
68
 
 
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"));
 
75
    }
 
76
 
 
77
    protected function tearDown() {
 
78
        I2CE_MagicData::tearDown();
 
79
        I2CE::resetFileSearch();
 
80
        I2CE::popErrorHandler(array(__CLASS__, "errorHandler"));
 
81
    }
 
82
 
 
83
    static public function errorHandler($base, $str, $type) {
 
84
        if($type === E_ERROR) {
 
85
            array_push(self::$errors, $str);
 
86
        }
 
87
        else {
 
88
            array_push(self::$not_errors, $str);
 
89
        }
 
90
        # Just keep them quiet for now.
 
91
    }
 
92
 
 
93
    static protected function addClassPath($path) {
 
94
        ini_set('include_path',ini_get('include_path').":".$path);
 
95
    }
 
96
 
 
97
    function tests() {
 
98
        if(get_class($this) === __CLASS__) {
 
99
            return 0;
 
100
        } else {
 
101
            return 1;
 
102
        }
 
103
    }
 
104
}
 
105
# Local Variables:
 
106
# mode: php
 
107
# c-default-style: bsd
 
108
# indent-tabs-mode: nil
 
109
# c-basic-offset: 4
 
110
# End: