Skip to content

Commit

Permalink
Consistency: testdox for method that is written in snake-case now sta…
Browse files Browse the repository at this point in the history
…rts with a uppercase letter
  • Loading branch information
dennis-fringe authored and sebastianbergmann committed Apr 25, 2018
1 parent c9c5a07 commit 7cd0cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Util/TestDox/NamePrettifier.php
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions tests/Util/TestDox/NamePrettifierTest.php
Expand Up @@ -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'));
Expand Down

0 comments on commit 7cd0cdb

Please sign in to comment.