-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathVCRTestListener.php
75 lines (62 loc) · 1.81 KB
/
VCRTestListener.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
declare(strict_types=1);
namespace VCR\PHPUnit\TestListener;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Framework\Warning;
use VCR\VCR;
/**
* A TestListener that integrates with PHP-VCR.
*
* Here is an example XML configuration for activating this listener in PHPUnit < 10.
*
* <code>
* <listeners>
* <listener class="VCR\PHPUnit\TestListener\VCRTestListener" file="vendor/php-vcr/phpunit-testlistener-vcr/src/VCRTestListener.php" />
* </listeners>
* </code>
*
* @author Adrian Philipp <[email protected]>
* @author Davide Borsatto <[email protected]>
* @author Renato Mefi <[email protected]>
*/
final class VCRTestListener implements TestListener
{
public function startTest(Test $test): void
{
$class = \get_class($test);
\assert($test instanceof TestCase);
VCRTestHandler::onStart($class, $test->getName(false));
}
public function endTest(Test $test, float $time): void
{
VCRTestHandler::onEnd();
}
public function addError(Test $test, \Throwable $t, float $time): void
{
}
public function addWarning(Test $test, Warning $e, float $time): void
{
}
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
}
public function addIncompleteTest(Test $test, \Throwable $e, float $time): void
{
}
public function addSkippedTest(Test $test, \Throwable $e, float $time): void
{
}
public function addRiskyTest(Test $test, \Throwable $e, float $time): void
{
}
public function startTestSuite(TestSuite $suite): void
{
}
public function endTestSuite(TestSuite $suite): void
{
}
}