-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
59 lines (52 loc) · 1.26 KB
/
index.php
File metadata and controls
59 lines (52 loc) · 1.26 KB
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
51
52
53
54
55
56
57
58
59
<?php
// get the list of TestSuites
foreach( glob("Test*.php") as $file)
{
echo 'TestSuite : ' . $file;
$className = substr( $file, 0, -4 );
echo $className;
require( $file );
try
{
$class = new ReflectionClass( $className );
if( $class->isInstantiable() )
{
$instance = $class->newInstance();
}
else
{
throw new Exception($className
. ' could not be instantiated' );
}
$method = $class->getMethod( 'setUp' );
echo 'setUp() method accessed successfully!';
echo ' Invoking Setup ';
$method->invoke( $instance ) ;
// invoke Test Methods
$methods = $class->getMethods();
echo 'Iterating over methods ' , PHP_EOL;
foreach( $methods as $m )
{
$methodName = $m->getName();
if( strcmp( $methodName, 'setUp' ) == 0 ||
strcmp( $methodName, 'tearDown' ) == 0 )
{
continue;
}
echo 'Invoking Method : ' , $methodName;
$m->invoke( $instance );
}
$method = $class->getMethod( 'tearDown' );
echo ' Invoking Teardown ';
$method->invoke( $instance ) ;
echo 'tearDown() method accessed successfully!';
}
catch( Exception $ex)
{
echo ' Error creating class ' , $ex->getMessage();
exit();
}
}
// display buttons for running all test suites
// display buttons for running individual test suites
?>