mirror of
https://github.com/pestphp/pest.git
synced 2026-12-06 07:42:17 +01:00
fix(tia): keep numeric file, branch and page names as strings (#2066)
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com> Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Pest\Plugins\Tia\Graph;
|
||||
use Pest\Plugins\Tia\WatchPatterns;
|
||||
use Pest\Support\Container;
|
||||
|
||||
beforeEach(function (): void {
|
||||
Container::getInstance()->add(WatchPatterns::class, new WatchPatterns);
|
||||
});
|
||||
|
||||
afterEach(function (): void {
|
||||
Container::getInstance()->add(WatchPatterns::class, new WatchPatterns);
|
||||
});
|
||||
|
||||
it('selects the tests of a changed source file whose name is a number', function (): void {
|
||||
$graph = new Graph(sys_get_temp_dir());
|
||||
$graph->link('tests/Feature/NumericTest.php', '123');
|
||||
$graph->link('tests/Feature/OtherTest.php', 'app/Other.php');
|
||||
|
||||
expect($graph->affected(['123']))->toBe(['tests/Feature/NumericTest.php']);
|
||||
});
|
||||
|
||||
it('selects the tests of a numeric source file after the graph is decoded', function (): void {
|
||||
$graph = new Graph(sys_get_temp_dir());
|
||||
$graph->link('tests/Feature/NumericTest.php', '123');
|
||||
|
||||
$decoded = Graph::decode($graph->encode(), sys_get_temp_dir());
|
||||
|
||||
expect($decoded?->affected(['123']))->toBe(['tests/Feature/NumericTest.php']);
|
||||
});
|
||||
Reference in New Issue
Block a user