This repository was archived by the owner on Oct 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestListener.php
More file actions
59 lines (53 loc) · 1.77 KB
/
TestListener.php
File metadata and controls
59 lines (53 loc) · 1.77 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
require_once 'Main.php';
class PHPConsistentTestListener implements PHPUnit_Framework_TestListener
{
/**
* PHPConsistent object
* @var PHPConsistent_Main
*/
private $_phpc;
/**
* Failures to report
* @var array
*/
private $_failures = array();
public function startTest(PHPUnit_Framework_Test $test)
{
$this->_phpc = new PHPConsistent_Main(
null,
(isset($args['depth']) ? $args['depth'] : 10),
(isset($args['ignorenull']) ? $args['ignorenull'] : false),
PHPConsistent_Main::LOG_TO_PHPUNIT,
array(
'PHPUnit'
),
array(
'PHPUnit_Framework_Assert'
),
array()
);
$this->_phpc->start();
}
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$this->_phpc->stop();
$failures = $this->_phpc->analyze();
if (count($failures) > 0) {
foreach ($failures as $failure) {
$this->_failures[] = $failure;
}
}
}
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {}
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {}
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {}
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}
public function __destruct()
{
// Process $this->_failures - code incomplete at this point
}
}