Skip to content

Commit c146604

Browse files
Closes #6115
1 parent be5aa22 commit c146604

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

ChangeLog-10.5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 10.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [10.5.44] - 2025-MM-DD
6+
7+
### Fixed
8+
9+
* [#6115](https://github.com/sebastianbergmann/phpunit/issues/6115): Backed enumerations with values not of type `string` cannot be used in customized TestDox output
10+
511
## [10.5.43] - 2025-01-29
612

713
### Changed
@@ -389,6 +395,7 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi
389395

390396
* [#5563](https://github.com/sebastianbergmann/phpunit/issues/5563): `createMockForIntersectionOfInterfaces()` does not automatically register mock object for expectation verification
391397

398+
[10.5.44]: https://github.com/sebastianbergmann/phpunit/compare/10.5.43...10.5
392399
[10.5.43]: https://github.com/sebastianbergmann/phpunit/compare/10.5.42...10.5.43
393400
[10.5.42]: https://github.com/sebastianbergmann/phpunit/compare/10.5.41...10.5.42
394401
[10.5.41]: https://github.com/sebastianbergmann/phpunit/compare/10.5.40...10.5.41

src/Logging/TestDox/NamePrettifier.php

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

292292
if ($enumReflector->isBacked()) {
293-
return $value->value;
293+
return (string) $value->value;
294294
}
295295

296296
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 <[email protected]>
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)