Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 3ee66da

Browse files
committed
Support PHPUnit 9
1 parent bc588b0 commit 3ee66da

File tree

6 files changed

+27
-13
lines changed

6 files changed

+27
-13
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ env:
44
CODECEPTION_VERSION: '4.0.x-dev'
55

66
php:
7-
- 7.2
87
- 7.3
8+
- 7.4
99

1010
before_script:
1111
- wget https://robo.li/robo.phar

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# PHPUnit Wrapper
22

33
Builds:
4+
* 9.0 [![Build Status](https://travis-ci.org/Codeception/phpunit-wrapper.svg?branch=9.0)](https://travis-ci.org/Codeception/phpunit-wrapper)
45
* 8.0 [![Build Status](https://travis-ci.org/Codeception/phpunit-wrapper.svg?branch=8.0)](https://travis-ci.org/Codeception/phpunit-wrapper)
56
* 7.1 [![Build Status](https://travis-ci.org/Codeception/phpunit-wrapper.svg?branch=7.1)](https://travis-ci.org/Codeception/phpunit-wrapper)
67
* 6.5 [![Build Status](https://travis-ci.org/Codeception/phpunit-wrapper.svg?branch=6.5)](https://travis-ci.org/Codeception/phpunit-wrapper)

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
{
88
"name": "Davert",
99
"email": "davert.php@resend.cc"
10+
},
11+
12+
{
13+
"name": "Naktibalda"
1014
}
1115
],
1216
"require": {
1317
"php": ">=7.2",
14-
"phpunit/phpunit": "^8.0",
15-
"phpunit/php-code-coverage": "^7.0",
16-
"sebastian/comparator": "^3.0",
17-
"sebastian/diff": "^3.0"
18+
"phpunit/phpunit": "^9.0"
1819
},
1920
"autoload": {
2021
"psr-4": {

src/ResultPrinter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use \PHPUnit\Framework\AssertionFailedError;
55
use \PHPUnit\Framework\Test;
6+
use PHPUnit\Framework\TestResult;
67
use \PHPUnit\Runner\BaseTestRunner;
78

89
class ResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter
@@ -93,4 +94,9 @@ public function startTest(\PHPUnit\Framework\Test $test) : void
9394
{
9495
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_PASSED;
9596
}
97+
98+
public function printResult(TestResult $result): void
99+
{
100+
// TODO: Implement printResult() method.
101+
}
96102
}

src/ResultPrinter/HTML.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Codeception\Test\Interfaces\ScenarioDriven;
99
use Codeception\TestInterface;
1010
use Codeception\Util\PathResolver;
11+
use PHPUnit\Framework\TestResult;
12+
use SebastianBergmann\Template\Template;
1113

1214
class HTML extends CodeceptionResultPrinter
1315
{
@@ -118,14 +120,14 @@ public function endTest(\PHPUnit\Framework\Test $test, float $time) : void
118120
}
119121
}
120122

121-
$scenarioTemplate = new \Text_Template(
123+
$scenarioTemplate = new Template(
122124
$this->templatePath . 'scenario.html'
123125
);
124126

125127
$failures = '';
126128
$name = Descriptor::getTestSignatureUnique($test);
127129
if (isset($this->failures[$name])) {
128-
$failTemplate = new \Text_Template(
130+
$failTemplate = new Template(
129131
$this->templatePath . 'fail.html'
130132
);
131133
foreach ($this->failures[$name] as $failure) {
@@ -173,7 +175,7 @@ public function endTest(\PHPUnit\Framework\Test $test, float $time) : void
173175

174176
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite) : void
175177
{
176-
$suiteTemplate = new \Text_Template(
178+
$suiteTemplate = new Template(
177179
$this->templatePath . 'suite.html'
178180
);
179181
if (!$suite->getName()) {
@@ -190,7 +192,7 @@ public function startTestSuite(\PHPUnit\Framework\TestSuite $suite) : void
190192
*/
191193
protected function endRun():void
192194
{
193-
$scenarioHeaderTemplate = new \Text_Template(
195+
$scenarioHeaderTemplate = new Template(
194196
$this->templatePath . 'scenario_header.html'
195197
);
196198

@@ -209,7 +211,7 @@ protected function endRun():void
209211

210212
$header = $scenarioHeaderTemplate->render();
211213

212-
$scenariosTemplate = new \Text_Template(
214+
$scenariosTemplate = new Template(
213215
$this->templatePath . 'scenarios.html'
214216
);
215217

@@ -277,7 +279,7 @@ public function startTest(\PHPUnit\Framework\Test $test):void
277279
*/
278280
protected function renderStep(Step $step)
279281
{
280-
$stepTemplate = new \Text_Template($this->templatePath . 'step.html');
282+
$stepTemplate = new Template($this->templatePath . 'step.html');
281283
$stepTemplate->setVar(['action' => $step->getHtml(), 'error' => $step->hasFailed() ? 'failedStep' : '']);
282284
return $stepTemplate->render();
283285
}
@@ -289,7 +291,7 @@ protected function renderStep(Step $step)
289291
*/
290292
protected function renderSubsteps(Meta $metaStep, $substepsBuffer)
291293
{
292-
$metaTemplate = new \Text_Template($this->templatePath . 'substeps.html');
294+
$metaTemplate = new Template($this->templatePath . 'substeps.html');
293295
$metaTemplate->setVar(['metaStep' => $metaStep->getHtml(), 'error' => $metaStep->hasFailed() ? 'failedStep' : '', 'steps' => $substepsBuffer, 'id' => uniqid()]);
294296
return $metaTemplate->render();
295297
}
@@ -303,4 +305,8 @@ private function cleanMessage($exception)
303305
$msg = str_replace(['<info>','</info>','<bold>','</bold>'], ['','','',''], $msg);
304306
return htmlentities($msg);
305307
}
308+
309+
public function printResult(TestResult $result): void
310+
{
311+
}
306312
}

src/ResultPrinter/UI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Symfony\Component\Console\Output\OutputInterface;
99
use Symfony\Component\EventDispatcher\EventDispatcher;
1010

11-
class UI extends \PHPUnit\TextUI\ResultPrinter
11+
class UI extends \PHPUnit\TextUI\DefaultResultPrinter
1212
{
1313
use DispatcherWrapper;
1414

0 commit comments

Comments
 (0)