1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author Jared King <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @link http://jaredtking.com |
7
|
|
|
* |
8
|
|
|
* @copyright 2015 Jared King |
9
|
|
|
* @license MIT |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Infuse; |
13
|
|
|
|
14
|
|
|
use Exception; |
15
|
|
|
use PHPUnit\Framework\AssertionFailedError; |
16
|
|
|
use PHPUnit\Framework\Test as PHPUnitTest; |
17
|
|
|
use PHPUnit\Framework\TestListener; |
18
|
|
|
use PHPUnit\Framework\TestSuite; |
19
|
|
|
use PHPUnit\Framework\Warning; |
20
|
|
|
|
21
|
|
|
class Test implements TestListener |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var Application |
25
|
|
|
*/ |
26
|
|
|
public static $app; |
27
|
|
|
|
28
|
|
|
public function __construct() |
29
|
|
|
{ |
30
|
|
|
// display all errors, log none |
31
|
|
|
ini_set('display_errors', 1); |
32
|
|
|
ini_set('log_errors', 0); |
33
|
|
|
error_reporting(E_ALL | E_STRICT); |
34
|
|
|
|
35
|
|
|
$config = []; |
36
|
|
|
if (file_exists('config.php')) { |
37
|
|
|
$config = include 'config.php'; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
self::$app = new Application($config, Application::ENV_TEST); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function addError(PHPUnitTest $test, Exception $e, $time) |
44
|
|
|
{ |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function addWarning(PHPUnitTest $test, Warning $e, $time) |
48
|
|
|
{ |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function addFailure(PHPUnitTest $test, AssertionFailedError $e, $time) |
52
|
|
|
{ |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function addIncompleteTest(PHPUnitTest $test, Exception $e, $time) |
56
|
|
|
{ |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function addRiskyTest(PHPUnitTest $test, Exception $e, $time) |
60
|
|
|
{ |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function addSkippedTest(PHPUnitTest $test, Exception $e, $time) |
64
|
|
|
{ |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function startTest(PHPUnitTest $test) |
68
|
|
|
{ |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function endTest(PHPUnitTest $test, $time) |
72
|
|
|
{ |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function startTestSuite(TestSuite $suite) |
76
|
|
|
{ |
77
|
|
|
printf("\n\n%s:\n", $suite->getName()); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function endTestSuite(TestSuite $suite) |
81
|
|
|
{ |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|