mirror of
https://github.com/pestphp/pest.git
synced 2026-12-03 22:45:06 +01:00
d314fc0540
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com> Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
24 lines
812 B
PHP
24 lines
812 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Pest\Plugins\Tia\WatchPatterns;
|
|
|
|
it('matches a watch pattern whose key is a number', function (): void {
|
|
$watchPatterns = new WatchPatterns;
|
|
$watchPatterns->add(['123' => 'tests/Feature']);
|
|
|
|
expect($watchPatterns->matchedDirectories(sys_get_temp_dir(), ['123']))->toBe(['tests/Feature']);
|
|
});
|
|
|
|
it('selects the tests under a watch target whose name is a number', function (): void {
|
|
$watchPatterns = new WatchPatterns;
|
|
$watchPatterns->add(['config.txt' => '123']);
|
|
|
|
$directories = $watchPatterns->matchedDirectories(sys_get_temp_dir(), ['config.txt']);
|
|
|
|
expect($directories)->toBe(['123'])
|
|
->and($watchPatterns->testsUnderDirectories($directories, ['123/ConfigTest.php', 'tests/OtherTest.php']))
|
|
->toBe(['123/ConfigTest.php']);
|
|
});
|