Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistency: testdox for method that is written in snake-case now starts with uppercase #3105

Merged
merged 1 commit into from Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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