diff --git a/src/Plugins/Tia.php b/src/Plugins/Tia.php index 6e6a83d8..ef6c083a 100644 --- a/src/Plugins/Tia.php +++ b/src/Plugins/Tia.php @@ -251,7 +251,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable return true; } - if (str_starts_with($arg, "$argument=")) { + if (str_starts_with((string) $arg, "$argument=")) { // @phpstan-ignore-line return true; } } @@ -1489,6 +1489,8 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable } foreach ($arguments as $index => $arg) { + $arg = (string) $arg; // @phpstan-ignore-line + if ($arg === '') { continue; } diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index e5337bab..0e38f50f 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -1752,6 +1752,10 @@ ✓ output format → it returns a 32-character hex xxh128 hash ✓ output format → it returns a stable hash for empty content + PASS Tests\Unit\Plugins\Tia\IsEnabledForRun + ✓ does not throw when an integer --random-order-seed is passed as a separate argv element + ✓ still detects --tia when an integer argument is present + PASS Tests\Unit\Preset ✓ preset invalid name ✓ preset → myFramework @@ -1937,4 +1941,4 @@ ✓ 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, 40 todos, 35 skipped, 1328 passed (3008 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 35 skipped, 1330 passed (3010 assertions) \ No newline at end of file diff --git a/tests/Unit/Plugins/Tia/IsEnabledForRun.php b/tests/Unit/Plugins/Tia/IsEnabledForRun.php new file mode 100644 index 00000000..cbcf6284 --- /dev/null +++ b/tests/Unit/Plugins/Tia/IsEnabledForRun.php @@ -0,0 +1,20 @@ +toBeFalse(); +}); + +test('still detects --tia when an integer argument is present', function () { + $arguments = ['--tia', '--random-order-seed', 1782350398]; + + expect(Tia::isEnabledForRun($arguments))->toBeTrue(); +}); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 72a79090..d497eef3 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -24,13 +24,13 @@ test('parallel', function () use ($run) { $file = file_get_contents(__FILE__); $file = preg_replace( '/\$expected = \'.*?\';/', - "\$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1312 passed (2957 assertions)';", + "\$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1314 passed (2959 assertions)';", $file, ); file_put_contents(__FILE__, $file); } - $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1312 passed (2957 assertions)'; + $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1314 passed (2959 assertions)'; expect($output) ->toContain("Tests: {$expected}")