diff --git a/src/Util/TestDox/NamePrettifier.php b/src/Util/TestDox/NamePrettifier.php index f61fdf68b6c..4974f247a13 100644 --- a/src/Util/TestDox/NamePrettifier.php +++ b/src/Util/TestDox/NamePrettifier.php @@ -63,7 +63,9 @@ public function prettifyTestMethod(string $name): string $this->strings[] = $string; } - if (\strpos($name, 'test') === 0) { + if (\strpos($name, 'test_') === 0) { + $name = \substr($name, 5); + } elseif (\strpos($name, 'test') === 0) { $name = \substr($name, 4); } diff --git a/tests/Util/TestDox/NamePrettifierTest.php b/tests/Util/TestDox/NamePrettifierTest.php index 0565b72cb9c..a31637f0dd0 100644 --- a/tests/Util/TestDox/NamePrettifierTest.php +++ b/tests/Util/TestDox/NamePrettifierTest.php @@ -43,6 +43,7 @@ public function testTestNameIsConvertedToASentence(): void $this->assertEquals('This is a test', $this->namePrettifier->prettifyTestMethod('testThisIsATest')); $this->assertEquals('This is a test', $this->namePrettifier->prettifyTestMethod('testThisIsATest2')); $this->assertEquals('This is a test', $this->namePrettifier->prettifyTestMethod('this_is_a_test')); + $this->assertEquals('This is a test', $this->namePrettifier->prettifyTestMethod('test_this_is_a_test')); $this->assertEquals('Foo for bar is 0', $this->namePrettifier->prettifyTestMethod('testFooForBarIs0')); $this->assertEquals('Foo for baz is 1', $this->namePrettifier->prettifyTestMethod('testFooForBazIs1')); $this->assertEquals('This has a 123 in its name', $this->namePrettifier->prettifyTestMethod('testThisHasA123InItsName'));