|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Travis CI test script. |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright YetiForce Sp. z o.o. |
|
6
|
|
|
* @license YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com) |
|
7
|
|
|
* @author Mariusz Krzaczkowski <[email protected]> |
|
8
|
|
|
* @author Michał Lorencik <[email protected]> |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
// @codeCoverageIgnoreStart |
|
12
|
|
|
class Times implements PHPUnit\Framework\TestListener |
|
13
|
|
|
{ |
|
14
|
|
|
public function startTest(PHPUnit\Framework\Test $test) |
|
15
|
|
|
{ |
|
16
|
|
|
//printf("Test %s started.\n", $test->getName()); |
|
17
|
|
|
echo "\n"; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function endTest(PHPUnit\Framework\Test $test, $time) |
|
21
|
|
|
{ |
|
22
|
|
|
$time = round($time, 2); |
|
|
|
|
|
|
23
|
|
|
echo " Time: $time second(s)"; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function addError(PHPUnit\Framework\Test $test, Exception $e, $time) |
|
27
|
|
|
{ |
|
28
|
|
|
echo 'Error in ' . $test->getName() . " !!!\n"; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function addWarning(PHPUnit\Framework\Test $test, PHPUnit\Framework\Warning $e, $time) |
|
32
|
|
|
{ |
|
33
|
|
|
echo 'Warning in ' . $test->getName() . " !!!\n"; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function addFailure(PHPUnit\Framework\Test $test, PHPUnit\Framework\AssertionFailedError $e, $time) |
|
37
|
|
|
{ |
|
38
|
|
|
echo 'Test ' . $test->getName() . " failed. $time\n"; |
|
39
|
|
|
echo 'Exception Message: ' . $e->getMessage() . "\n"; |
|
40
|
|
|
//echo "Exception Trace: " . $e->getTraceAsString() . "\n"; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function addIncompleteTest(PHPUnit\Framework\Test $test, Exception $e, $time) |
|
44
|
|
|
{ |
|
45
|
|
|
$time = round($time, 2); |
|
|
|
|
|
|
46
|
|
|
printf("addIncompleteTest: Test '%s' is incomplete.\n", $test->getName()); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function addRiskyTest(PHPUnit\Framework\Test $test, Exception $e, $time) |
|
50
|
|
|
{ |
|
51
|
|
|
printf("Test %s is deemed risky.\n", $test->getName()); |
|
52
|
|
|
echo 'Exception Message: ' . $e->getMessage() . "\n"; |
|
53
|
|
|
echo 'Exception Trace: ' . $e->getTraceAsString() . "\n"; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function addSkippedTest(PHPUnit\Framework\Test $test, Exception $e, $time) |
|
57
|
|
|
{ |
|
58
|
|
|
$time = round($time, 2); |
|
|
|
|
|
|
59
|
|
|
printf("Test '%s' has been skipped. ($time second(s))\n", $test->getName()); |
|
60
|
|
|
echo 'Exception Message: ' . $e->getMessage() . "\n"; |
|
61
|
|
|
echo 'Exception Trace: ' . $e->getTraceAsString() . "\n"; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function startTestSuite(PHPUnit\Framework\TestSuite $suite) |
|
65
|
|
|
{ |
|
66
|
|
|
//printf("Started all tests: %s \n", $suite->getName()); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function endTestSuite(PHPUnit\Framework\TestSuite $suite) |
|
70
|
|
|
{ |
|
71
|
|
|
//printf("Ended all tests: %s.\n", $suite->getName()); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
// @codeCoverageIgnoreEnd |
|
76
|
|
|
|