mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: methods name with \
This commit is contained in:
@ -56,7 +56,7 @@ final class Str
|
||||
{
|
||||
$code = str_replace(' ', '_', $code);
|
||||
|
||||
return (string) preg_replace('/[^A-Z_a-z0-9\\\\]/', '', $code);
|
||||
return (string) preg_replace('/[^A-Z_a-z0-9]/', '_', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -858,6 +858,11 @@
|
||||
✓ it gets file name from closure
|
||||
✓ it gets property values
|
||||
|
||||
PASS Tests\Unit\Support\Str
|
||||
✓ it evaluates the code with ('version()', 'version__')
|
||||
✓ it evaluates the code with ('version__ ', 'version___')
|
||||
✓ it evaluates the code with ('version\', 'version_')
|
||||
|
||||
PASS Tests\Unit\TestSuite
|
||||
✓ it does not allow to add the same test description twice
|
||||
✓ it alerts users about tests with arguments but no input
|
||||
@ -885,4 +890,4 @@
|
||||
PASS Tests\Visual\Version
|
||||
✓ visual snapshot of help command output
|
||||
|
||||
Tests: 4 incomplete, 2 todos, 18 skipped, 616 passed (1526 assertions)
|
||||
Tests: 4 incomplete, 2 todos, 18 skipped, 619 passed (1529 assertions)
|
||||
13
tests/Unit/Support/Str.php
Normal file
13
tests/Unit/Support/Str.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Pest\Support\Str;
|
||||
|
||||
it('evaluates the code', function ($evaluatable, $expected) {
|
||||
$code = Str::evaluable($evaluatable);
|
||||
|
||||
expect($code)->toBe($expected);
|
||||
})->with([
|
||||
['version()', 'version__'],
|
||||
['version__ ', 'version___'],
|
||||
['version\\', 'version_'],
|
||||
]);
|
||||
Reference in New Issue
Block a user