Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Factories/TestCaseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public function evaluate(string $filename, array $methods): void
$relativePath = (string) preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $relativePath);
// Remove escaped quote sequences (maintain namespace)
$relativePath = str_replace(array_map(fn (string $quote): string => sprintf('\\%s', $quote), ['\'', '"']), '', $relativePath);
// Limit to A-Z, a-z, 0-9, '_', '-'.
$relativePath = (string) preg_replace('/[^A-Za-z0-9\\\\]/', '', $relativePath);
// Limit to Unicode letters and numbers.
$relativePath = (string) preg_replace('/[^\p{L}\p{N}\\\\]/u', '', $relativePath);

$classFQN = 'P\\'.$relativePath;

Expand Down
6 changes: 5 additions & 1 deletion tests/.snapshots/success.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1775,11 +1775,15 @@
- todo
- todo in parallel

PASS Tests\Visual\UnicodeFilename
✓ filter works with unicode characters in filename
✓ filter with unicode regex matches unicode filename

WARN Tests\Visual\Version
- visual snapshot of help command output

PASS Testsexternal\Features\Expect\toMatchSnapshot
✓ pass with dataset with ('my-datas-set-value')
✓ within describe → pass with dataset with ('my-datas-set-value')

Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1188 passed (2813 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1190 passed (2818 assertions)
3 changes: 3 additions & 0 deletions tests/.tests/StraßenTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

it('tests unicode filename with ß')->assertTrue(true);
37 changes: 37 additions & 0 deletions tests/Visual/UnicodeFilename.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Symfony\Component\Process\Process;

test('filter works with unicode characters in filename', function () {
$process = new Process([
'php',
'bin/pest',
'tests/.tests/StraßenTest.php',
'--colors=never',
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']);

$process->run();

$output = $process->getOutput();

expect($output)->toContain('StraßenTest');
expect($output)->toContain('tests unicode filename');
expect($output)->toContain('1 passed');
})->skipOnWindows();

test('filter with unicode regex matches unicode filename', function () {
$process = new Process([
'php',
'bin/pest',
'--filter=.*Straß.*',
'tests/.tests/',
'--colors=never',
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']);

$process->run();

$output = $process->getOutput();

expect($output)->toContain('StraßenTest');
expect($output)->toContain('1 passed');
})->skipOnWindows();