-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
feature/loggingIssues related to logging test resultsIssues related to logging test resultsfeature/logging/junitIssues related to logging test results in JUnit XML formatIssues related to logging test results in JUnit XML formattype/bugSomething is brokenSomething is brokenversion/10Something affects PHPUnit 10Something affects PHPUnit 10
Description
| Q | A |
|---|---|
| PHPUnit version | 10.0.12 |
| PHP version | 8.1.14 |
| Installation Method | Composer |
Summary
The JUnit logger crashes when a test is skipped because of missing required PHP extension when running in separate process.
Introduced by PHPUnit 10.0.12.
Current behavior
PHPUnit 10.0.12 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.14
Configuration: /path/phpunit-10-test/phpunit.xml
.S 2 / 2 (100%)
An error occurred inside PHPUnit.
Message: assert($this->currentTestCase !== null)
Location: /path/phpunit-10-test/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:68
#0 /path/phpunit-10-test/vendor/phpunit/phpunit/src/TextUI/Application.php(142): PHPUnit\TextUI\TestRunner->run()
#1 /path/phpunit-10-test/vendor/phpunit/phpunit/phpunit(90): PHPUnit\TextUI\Application->run()
#2 /path/phpunit-10-test/vendor/bin/phpunit(123): include('...')
#3 {main}
How to reproduce
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="junit.xml"/>
</logging>
</phpunit>tests/FooTest.php
<?php
declare(strict_types=1);
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
class FooTest extends TestCase
{
public function testOne(): void
{
$this->assertTrue(true);
}
#[RunInSeparateProcess]
#[RequiresPhpExtension('notinstalled')]
public function testTwo(): void
{
$this->assertTrue(true);
}
}Expected behavior
PHPUnit 10.0.11 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.14
Configuration: /path/phpunit-10-test/phpunit.xml
.S 2 / 2 (100%)
Time: 00:00.067, Memory: 8.00 MB
OK, but some tests were skipped!
Tests: 2, Assertions: 1, Skipped: 1.
Metadata
Metadata
Assignees
Labels
feature/loggingIssues related to logging test resultsIssues related to logging test resultsfeature/logging/junitIssues related to logging test results in JUnit XML formatIssues related to logging test results in JUnit XML formattype/bugSomething is brokenSomething is brokenversion/10Something affects PHPUnit 10Something affects PHPUnit 10