blob: 805148757dc5244a3f64b974884ac31fc1af8fc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
if(!defined('FRAMEWORK_DIR'))
define('FRAMEWORK_DIR',realpath(dirname(__FILE__).'/../../../framework'));
if(!defined('SIMPLETEST_DIR'))
define('SIMPLETEST_DIR',realpath(dirname(__FILE__).'/../simpletest'));
require_once(SIMPLETEST_DIR.'/unit_tester.php');
require_once(SIMPLETEST_DIR.'/reporter.php');
require_once(SIMPLETEST_DIR.'/HtmlReporterWithCoverage.php');
require_once(FRAMEWORK_DIR.'/core.php');
class Prado extends PradoBase
{
}
function __autoload($className)
{
require_once($className.Prado::CLASS_FILE_EXT);
}
error_reporting(E_ALL);
restore_error_handler();
/**
* PradoTestCase class.
*
* Extends the simpletest UnitTestCase class to provide some fairly generic extra functionality.
*
* @author Alex Flint <alex@linium.net>
*/
class PradoUnitTestCase extends UnitTestCase {
/**
* Tests whether the given code results in an appropriate exception being raised.
* @param string the PHP code to execute. must end with a semi-colon.
* @param string the type of exception that should be raised.
* @return boolean true
*/
public function assertException(string $code, string $exceptionType) {
$ex = null;
eval("try { $code } catch ($exceptionType \$e) { \$ex = \$e; }");
$this->assertIsA($ex, $exceptionType);
}
}
?>
|