Skip to content

Commit f65c9e1

Browse files
Merge branch '10.5' into 11.5
2 parents 5b59f0b + c146604 commit f65c9e1

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

ChangeLog-11.5.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
88

99
* [#6112](https://github.com/sebastianbergmann/phpunit/pull/6112): Improve performance of `SourceMapper`
1010

11+
### Fixed
12+
13+
* [#6115](https://github.com/sebastianbergmann/phpunit/issues/6115): Backed enumerations with values not of type `string` cannot be used in customized TestDox output
14+
1115
## [11.5.5] - 2025-01-29
1216

1317
### Changed

src/Logging/TestDox/NamePrettifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private function objectToString(object $value): string
293293
$enumReflector = new ReflectionEnum($value);
294294

295295
if ($enumReflector->isBacked()) {
296-
return $value->value;
296+
return (string) $value->value;
297297
}
298298

299299
return $value->name;

tests/end-to-end/regression/6115.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/6115
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--testdox';
8+
$_SERVER['argv'][] = __DIR__ . '/6115/Issue6115Test.php';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
Runtime: %s
17+
18+
. 1 / 1 (100%)
19+
20+
Time: %s, Memory: %s
21+
22+
Issue6115 (PHPUnit\TestFixture\Issue6115\Issue6115)
23+
1
24+
25+
OK (1 test, 1 assertion)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\Issue6115;
11+
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\Attributes\TestDox;
14+
use PHPUnit\Framework\TestCase;
15+
16+
enum Enumeration: int
17+
{
18+
case A = 1;
19+
}
20+
21+
final class Issue6115Test extends TestCase
22+
{
23+
public static function provider(): array
24+
{
25+
return [
26+
[
27+
Enumeration::A,
28+
],
29+
];
30+
}
31+
32+
#[DataProvider('provider')]
33+
#[TestDox('$enumeration')]
34+
public function testOne(Enumeration $enumeration): void
35+
{
36+
$this->assertTrue(true);
37+
}
38+
}

0 commit comments

Comments
 (0)