Skip to content

Commit

Permalink
Update PHPUnit compatibility to 11.3.2 (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Sep 3, 2024
1 parent 628e46c commit e52a4b7
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"phpunit/php-code-coverage": "^11.0.6",
"phpunit/php-file-iterator": "^5.1.0",
"phpunit/php-timer": "^7.0.1",
"phpunit/phpunit": "^11.3.1",
"phpunit/phpunit": "^11.3.2",
"sebastian/environment": "^7.2.0",
"symfony/console": "^6.4.10 || ^7.1.3",
"symfony/console": "^6.4.11 || ^7.1.4",
"symfony/process": "^6.4.8 || ^7.1.3"
},
"require-dev": {
Expand Down
4 changes: 3 additions & 1 deletion src/JUnit/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/** @internal */
final class Writer
{
private const TESTSUITES_NAME = 'PHPUnit tests';
private readonly DOMDocument $document;

public function __construct()
Expand All @@ -47,6 +48,7 @@ private function getXml(TestSuite $testSuite): string
{
$xmlTestsuites = $this->document->createElement('testsuites');
$xmlTestsuites->appendChild($this->createSuiteNode($testSuite));
$xmlTestsuites->setAttribute('name', self::TESTSUITES_NAME);
$this->document->appendChild($xmlTestsuites);

$xml = $this->document->saveXML();
Expand All @@ -58,7 +60,7 @@ private function getXml(TestSuite $testSuite): string
private function createSuiteNode(TestSuite $parentSuite): DOMElement
{
$suiteNode = $this->document->createElement('testsuite');
$suiteNode->setAttribute('name', $parentSuite->name);
$suiteNode->setAttribute('name', $parentSuite->name !== self::TESTSUITES_NAME ? $parentSuite->name : '');
if ($parentSuite->file !== '') {
$suiteNode->setAttribute('file', $parentSuite->file);
}
Expand Down
5 changes: 4 additions & 1 deletion src/WrapperRunner/ApplicationForWrapperWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ private function bootstrap(): void
}

if (isset($this->testdoxFile)) {
$this->testdoxResultCollector = new TestResultCollector(EventFacade::instance());
$this->testdoxResultCollector = new TestResultCollector(
EventFacade::instance(),
$this->configuration->source(),
);
}

TestResultFacade::init();
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/combined.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="" tests="7" assertions="3" errors="1" failures="1" skipped="2" time="1.234567">
<testsuite name="ParaTest\Tests\fixtures\common_results\ErrorTest" file="./test/fixtures/common_results/ErrorTest.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="1.234567">
<testcase name="testError" file="./test/fixtures/common_results/ErrorTest.php" line="13" class="ParaTest\Tests\fixtures\common_results\ErrorTest" classname="ParaTest.Tests.fixtures.common_results.ErrorTest" assertions="0" time="1.234567">
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/ErrorTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\ErrorTest" file="./test/fixtures/common_results/ErrorTest.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="1.234567">
<testcase name="testError" file="./test/fixtures/common_results/ErrorTest.php" line="13" class="ParaTest\Tests\fixtures\common_results\ErrorTest" classname="ParaTest.Tests.fixtures.common_results.ErrorTest" assertions="0" time="1.234567">
<error type="RuntimeException">ParaTest\Tests\fixtures\common_results\ErrorTest::testError
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/FailureTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\FailureTest" file="./test/fixtures/common_results/FailureTest.php" tests="1" assertions="1" errors="0" failures="1" skipped="0" time="1.234567">
<testcase name="testFailure" file="./test/fixtures/common_results/FailureTest.php" line="12" class="ParaTest\Tests\fixtures\common_results\FailureTest" classname="ParaTest.Tests.fixtures.common_results.FailureTest" assertions="1" time="1.234567">
<failure type="PHPUnit\Framework\ExpectationFailedException">ParaTest\Tests\fixtures\common_results\FailureTest::testFailure
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/IncompleteTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\IncompleteTest" file="./test/fixtures/common_results/IncompleteTest.php" tests="1" assertions="0" errors="0" failures="0" skipped="1" time="1.234567">
<testcase name="testIncomplete" file="./test/fixtures/common_results/IncompleteTest.php" line="12" class="ParaTest\Tests\fixtures\common_results\IncompleteTest" classname="ParaTest.Tests.fixtures.common_results.IncompleteTest" assertions="0" time="1.234567">
<skipped/>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/RiskyTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\RiskyTest" file="./test/fixtures/common_results/RiskyTest.php" tests="1" assertions="0" errors="0" failures="0" skipped="0" time="1.234567">
<testcase name="testRisky" file="./test/fixtures/common_results/RiskyTest.php" line="12" class="ParaTest\Tests\fixtures\common_results\RiskyTest" classname="ParaTest.Tests.fixtures.common_results.RiskyTest" assertions="0" time="1.234567"/>
</testsuite>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/SkippedTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\SkippedTest" file="./test/fixtures/common_results/SkippedTest.php" tests="1" assertions="0" errors="0" failures="0" skipped="1" time="1.234567">
<testcase name="testSkipped" file="./test/fixtures/common_results/SkippedTest.php" line="12" class="ParaTest\Tests\fixtures\common_results\SkippedTest" classname="ParaTest.Tests.fixtures.common_results.SkippedTest" assertions="0" time="1.234567">
<skipped/>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/SuccessTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\SuccessTest" file="./test/fixtures/common_results/SuccessTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.234567">
<testcase name="testSuccess" file="./test/fixtures/common_results/SuccessTest.php" line="12" class="ParaTest\Tests\fixtures\common_results\SuccessTest" classname="ParaTest.Tests.fixtures.common_results.SuccessTest" assertions="1" time="1.234567"/>
</testsuite>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/common_results/junit/WarningTest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\common_results\WarningTest" file="./test/fixtures/common_results/WarningTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.234567">
<testcase name="testWarning" file="./test/fixtures/common_results/WarningTest.php" line="16" class="ParaTest\Tests\fixtures\common_results\WarningTest" classname="ParaTest.Tests.fixtures.common_results.WarningTest" assertions="1" time="1.234567"/>
</testsuite>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuites name="PHPUnit tests">
<testsuite name="ParaTest\Tests\fixtures\special_chars\UnitTestWithDataProviderSpecialCharsTest" file="./test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php" tests="42" assertions="42" errors="0" failures="42" skipped="0" time="1.234567">
<testsuite name="ParaTest\Tests\fixtures\special_chars\UnitTestWithDataProviderSpecialCharsTest::testIsItFalse" tests="42" assertions="42" errors="0" failures="42" skipped="0" time="1.234567">
<testcase name="testIsItFalse with data set #0" file="./test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php" line="16" class="ParaTest\Tests\fixtures\special_chars\UnitTestWithDataProviderSpecialCharsTest" classname="ParaTest.Tests.fixtures.special_chars.UnitTestWithDataProviderSpecialCharsTest" assertions="1" time="1.234567">
Expand Down

0 comments on commit e52a4b7

Please sign in to comment.