Skip to content

Commit

Permalink
fix: description when using ふが chars
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Mar 21, 2023
1 parent 26bb0b6 commit 48ae4bf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Support/Str.php
Expand Up @@ -61,7 +61,7 @@ public static function evaluable(string $code): string
{
$code = self::PREFIX.str_replace(' ', '_', $code);

return (string) preg_replace('/[^A-Z_a-z0-9]/', '_', $code);
return (string) preg_replace('/[^\p{L}_0-9]/', '_', $code);
}

/**
Expand Down
20 changes: 20 additions & 0 deletions tests/Unit/TestName.php
Expand Up @@ -11,3 +11,23 @@
['PPPackages\Foo', 'PPPackages\Foo'],
['PPPackages\Foo', 'PPPackages\Foo'],
]);

$names = [
'ふが' => '__pest_evaluable_ふが',
'ほげ' => 'ほげ',
'卜竹弓一十山' => '卜竹弓一十山',
'!p8VrB' => '!p8VrB',
'&xe6VeKWF#n4' => '&xe6VeKWF#n4',
'%%HurHUnw7zM!' => '%%HurHUnw7zM!',
'rundeliekend' => 'rundeliekend',
'g%%c!Jt9$fy#Kf' => 'g%%c!Jt9$fy#Kf',
'NRs*Gz2@hmB$W$BPD%%b2U%3P%z%apnwSX' => 'NRs*Gz2@hmB$W$BPD%%b2U%3P%z%apnwSX',
];

foreach ($names as $name => $methodName) {
test($name)
->expect(fn () => static::getLatestPrintableTestCaseMethodName())
->toBe($name)
->and(fn () => $this->name())
->toBe($methodName);
}

0 comments on commit 48ae4bf

Please sign in to comment.