| Q |
A |
| PHPUnit version |
11.5.3 |
| PHP version |
8.3.16 |
| Installation Method |
Composer |
Summary
Test marked as skipped throws exception when using --log-junit since v11.5.3.
Current behavior
Some of my tests are marked as skipped using $this->markTestSkipped('This test is still broken');. When running PHPUnit with --log-junit, it throws an exception due to changes made in d099069 (fixing #6098)
How to reproduce
Create a test with following body:
public function setUp(): void
{
parent::setUp();
$this->markTestSkipped('This test is still broken');
}
Executing the test causes following error:
vendor/bin/phpunit MyTest.php --log-junit=log.xml
PHPUnit 11.5.3 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.16
Configuration: /Users/ionbazan/work/project1/phpunit.xml
S 1 / 1 (100%)
An error occurred inside PHPUnit.
Message: assert($this->currentTestCase !== null)
Location: /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Logging/JUnit/JunitXmlLogger.php:200
#0 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Logging/JUnit/JunitXmlLogger.php(200): assert(false, 'assert($this->c...')
#1 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPrintedUnexpectedOutputSubscriber.php(24): PHPUnit\Logging\JUnit\JunitXmlLogger->testPrintedUnexpectedOutput(Object(PHPUnit\Event\Test\PrintedUnexpectedOutput))
#2 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Event/Dispatcher/DirectDispatcher.php(106): PHPUnit\Logging\JUnit\TestPrintedUnexpectedOutputSubscriber->notify(Object(PHPUnit\Event\Test\PrintedUnexpectedOutput))
#3 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Event/Dispatcher/DeferringDispatcher.php(47): PHPUnit\Event\DirectDispatcher->dispatch(Object(PHPUnit\Event\Test\PrintedUnexpectedOutput))
#4 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Event/Emitter/DispatchingEmitter.php(1009): PHPUnit\Event\DeferringDispatcher->dispatch(Object(PHPUnit\Event\Test\PrintedUnexpectedOutput))
#5 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(210): PHPUnit\Event\DispatchingEmitter->testPrintedUnexpectedOutput('\n')
#6 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Framework/TestCase.php(361): PHPUnit\Framework\TestRunner->run(Object(MyTest))
#7 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#8 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#9 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#10 /Users/ionbazan/work/project1/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#11 /Users/ionbazan/work/project1/vendor/bin/phpunit(122): include('/Users/ionbazan...')
#12 {main}
Expected behavior
No error should be thrown.
Summary
Test marked as skipped throws exception when using
--log-junitsince v11.5.3.Current behavior
Some of my tests are marked as skipped using
$this->markTestSkipped('This test is still broken');. When running PHPUnit with--log-junit, it throws an exception due to changes made in d099069 (fixing #6098)How to reproduce
Create a test with following body:
Executing the test causes following error:
Expected behavior
No error should be thrown.