Skip to content

Commit c1ab6ee

Browse files
test: Add pluralPascal tests with various count parameters
Test pluralPascal behavior with different count values (0, 1, 2), arrays and Countable objects to ensure comprehensive coverage.
1 parent 5f30613 commit c1ab6ee

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/Support/SupportStrTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,22 @@ public function testPluralPascal(): void
17971797
$this->assertSame('UserGroups', Str::pluralPascal('UserGroup'));
17981798
$this->assertSame('ProductCategories', Str::pluralPascal('ProductCategory'));
17991799

1800-
1801-
1800+
// Test with different count values and array
1801+
$this->assertSame('UserGroups', Str::pluralPascal('UserGroup', 0)); // plural
1802+
$this->assertSame('UserGroup', Str::pluralPascal('UserGroup', 1)); // singular
1803+
$this->assertSame('UserGroups', Str::pluralPascal('UserGroup', 2)); // plural
1804+
$this->assertSame('UserGroups', Str::pluralPascal('UserGroup', [])); // plural (empty array count is 0)
1805+
1806+
// Test with Countable
1807+
$countable = new class implements \Countable
1808+
{
1809+
public function count(): int
1810+
{
1811+
return 3;
1812+
}
1813+
};
1814+
1815+
$this->assertSame('UserGroups', Str::pluralPascal('UserGroup', $countable));
18021816
}
18031817
}
18041818

0 commit comments

Comments
 (0)