Skip to content

Commit 9dfcabc

Browse files
committed
Add PascalCase filter - Close #16
1 parent a46f883 commit 9dfcabc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/FilterFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public static function camelCaseFilter(): callable
5454
return new LowerCaseFirst(self::normalizeFilter());
5555
}
5656

57+
public static function pascalCaseFilter(): callable
58+
{
59+
return new UpperCaseFirst(self::normalizeFilter());
60+
}
61+
5762
/**
5863
* Returns a filter for valid class names e.g. AddBuilding
5964
*

tests/FilterFactoryTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ public function it_filters_camel_case(string $label): void
4747
$this->assertSame('addBuilding', ($filter)($label));
4848
}
4949

50+
/**
51+
* @test
52+
* @dataProvider providerForLabel
53+
* @param string $label
54+
*/
55+
public function it_filters_pascal_case(string $label): void
56+
{
57+
$filter = FilterFactory::pascalCaseFilter();
58+
$this->assertSame('AddBuilding', ($filter)($label));
59+
}
60+
5061
/**
5162
* @test
5263
* @dataProvider providerForLabel

0 commit comments

Comments
 (0)