Skip to content

Commit 1966493

Browse files
committed
Fixes #17. Adds tests
1 parent 3a721be commit 1966493

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
6+
before_script: composer install
7+
8+
script: ./vendor/bin/phpunit

src/PrettyPrinter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public function endTest(Test $test, float $time): void
3131

3232
$testMethodName = \PHPUnit\Util\Test::describe($test);
3333

34-
// convert snakeCase method name to camelCase
34+
// Convert snakeCase method name to camelCase
3535
$testMethodName[1] = str_replace('_', '', ucwords($testMethodName[1], '_'));
36-
36+
3737
preg_match_all('/((?:^|[A-Z])[a-z]+)/', $testMethodName[1], $matches);
3838
$testNameArray = array_map('strtolower', $matches[0]);
3939

@@ -44,7 +44,7 @@ public function endTest(Test $test, float $time): void
4444

4545
$name = implode(' ', $testNameArray);
4646

47-
// get the data set name
47+
// Get the data set name
4848
$name = $this->handleDataSetName($name, $testMethodName[1]);
4949

5050
$color = 'fg-green';

tests/Output.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,14 @@ public function testIncomplete(): void
3030
{
3131
$this->markTestIncomplete('incomplete');
3232
}
33+
34+
public function testShouldConvertTitleCaseToLowercasedWords()
35+
{
36+
$this->assertTrue(true);
37+
}
38+
39+
public function test_should_convert_snake_case_to_lowercased_words()
40+
{
41+
$this->assertTrue(true);
42+
}
3343
}

tests/PrinterTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ public function testFifthTestShouldBeIncomplete()
3939
$this->assertStringContainsString('∅ incomplete', $lines[8]);
4040
}
4141

42+
public function testTestNamesCanBeTitleCased()
43+
{
44+
$lines = $this->getOutput();
45+
46+
$this->assertStringContainsString('✓ should convert title case to lowercased words', $lines[9]);
47+
}
48+
49+
public function testTestNameCanBeSnakeCased()
50+
{
51+
$lines = $this->getOutput();
52+
53+
$this->assertStringContainsString('✓ should convert snake case to lowercased words', $lines[10]);
54+
}
55+
4256
private function getOutput(): array
4357
{
4458
$command = [

0 commit comments

Comments
 (0)