|
4 | 4 |
|
5 | 5 | use Codeception\Exception\ModuleException;
|
6 | 6 | use Codeception\Module;
|
| 7 | +use Codeception\TestInterface; |
| 8 | +use Exception; |
7 | 9 | use PHPUnit\Framework\AssertionFailedError;
|
8 | 10 | use Symfony\Component\Process\Exception\ProcessFailedException;
|
9 | 11 | use Symfony\Component\Process\Process;
|
@@ -91,17 +93,28 @@ public function _init(): void
|
91 | 93 | *
|
92 | 94 | * @param mixed $test The test case.
|
93 | 95 | */
|
94 |
| - public function _before(mixed $test): void |
| 96 | + public function _before(TestInterface $test): void |
95 | 97 | {
|
96 |
| - $this->sendCommand('_before', [$test]); |
| 98 | + $this->sendCommand('_before', [ |
| 99 | + 'test' => ['title' => $test->getMetadata()->getName()], |
| 100 | + ]); |
97 | 101 | }
|
98 | 102 |
|
99 | 103 | /**
|
100 | 104 | * Execute actions after a test.
|
101 | 105 | */
|
102 |
| - public function _after(mixed $test): void |
| 106 | + public function _after(TestInterface $test): void |
| 107 | + { |
| 108 | + $this->sendCommand('_after', [ |
| 109 | + 'test' => ['title' => $test->getMetadata()->getName()], |
| 110 | + ]); |
| 111 | + } |
| 112 | + |
| 113 | + public function _failed(TestInterface $test, Exception $fail) |
103 | 114 | {
|
104 |
| - $this->sendCommand('_after'); |
| 115 | + $this->sendCommand('_failed', [ |
| 116 | + 'test' => ['title' => $test->getMetadata()->getName()], |
| 117 | + ]); |
105 | 118 | }
|
106 | 119 |
|
107 | 120 | public function _restart()
|
|
0 commit comments