Compare commits

...

6 Commits

Author SHA1 Message Date
nuno maduro b5fed82883 chore: style 2026-06-25 20:24:28 +01:00
nuno maduro 145e20db75 chore: merges 4.x 2026-06-25 20:20:20 +01:00
nuno maduro ee2e97e932 release: v4.7.4 2026-06-25 20:09:05 +01:00
nuno maduro b561236325 chore: bumps phpunit 2026-06-25 20:09:05 +01:00
dependabot[bot] e685179b7e Bump actions/checkout from 6.0.3 to 7.0.0 in the github-actions group (#1737)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-25 20:03:39 +01:00
Conor Murphy ac8feafdcc fix: guard Tia argv scanning against non-string args (#1736)
The Tia plugin scans the raw argv with str_starts_with() in
argumentPresent() and hasExplicitPathArgument(). In the parallel worker
path (bin/worker.php) the unserialized argv can contain an integer
--random-order-seed value as a separate element, which made
str_starts_with() throw:

    TypeError: str_starts_with(): Argument #1 ($haystack) must be of
    type string, int given

This is the same class of bug as #1206, which was only fixed in
HandleArguments; it resurfaced in the newer Tia plugin. Cast each argv
element to string before scanning, mirroring the #1206 fix.

Adds a regression test, and updates the parallel count assertion and the
success snapshot to account for it.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:03:06 +01:00
10 changed files with 55 additions and 10 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
+1 -1
View File
@@ -6,7 +6,7 @@ namespace Pest;
function version(): string
{
return '5.0.0-rc.10';
return '5.0.0-rc.11';
}
function testDirectory(string $file = ''): string
+1 -1
View File
@@ -204,7 +204,7 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
TestSuite::getInstance()->testPath,
);
$output = (new Process($command))->setTimeout(120)->mustRun()->getOutput();
$output = new Process($command)->setTimeout(120)->mustRun()->getOutput();
return $this->parseListTestsOutput($output);
}
+3 -1
View File
@@ -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;
}
@@ -1,5 +1,5 @@
Pest Testing Framework 5.0.0-rc.10.
Pest Testing Framework 5.0.0-rc.11.
USAGE: pest <file> [options]
@@ -1,3 +1,3 @@
Pest Testing Framework 5.0.0-rc.10.
Pest Testing Framework 5.0.0-rc.11.
+24 -1
View File
@@ -517,6 +517,13 @@
✓ pass
✓ failures
✓ failures with custom message
✓ not failures
PASS Tests\Features\Expect\toBeEmail
✓ pass
✓ failures
✓ failures with custom message
✓ failures with default message
✓ not failures
PASS Tests\Features\Expect\toBeEmpty
@@ -1756,6 +1763,18 @@
✓ ensureFilterLengthIsSafe → it accepts filter within custom limit
✓ handleArguments → it returns original arguments when shard option is not present
✓ handleArguments → it removes parallel arguments from test discovery
✓ parseListTestsOutput → it parses Tests\ namespaced classes from --list-tests output
✓ parseListTestsOutput → it deduplicates repeated class names from multiple test methods
✓ parseListTestsOutput → it returns an empty list for output with no matching lines
✓ parseListTestsOutput → it parses non-Tests namespaced classes
✓ parseListTestsOutput → it parses unnamespaced top-level classes
✓ parseListTestsOutput → it strips the P\ Pest prefix but keeps the rest of the FQCN
✓ parseListTestsOutput → it ignores junk lines that lack the " - …::" framing
✓ buildListTestsCommand → it builds the list-tests command with the forwarded --test-directory
✓ buildListTestsCommand → it strips --parallel and -p when building the list-tests command
✓ buildListTestsCommand → it forwards --test-directory even when input arguments include one
✓ buildListTestsCommand → it strips --processes=N when building the list-tests command
✓ buildListTestsCommand → it strips --processes N (space-separated) when building the list-tests command
✓ addOutput → it displays shard information after test execution
✓ addOutput → it uses singular form for single test file
✓ addOutput → it returns original exit code when shard is not set
@@ -1797,6 +1816,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
@@ -1983,4 +2006,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, 1370 passed (3068 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 35 skipped, 1389 passed (3097 assertions)
@@ -0,0 +1,20 @@
<?php
use Pest\Plugins\Tia;
test('does not throw when an integer --random-order-seed is passed as a separate argv element', function () {
// Mirrors the parallel worker argv (see bin/worker.php), where
// `--random-order-seed` and its value arrive as separate items and the
// seed value is an int rather than a string. Regression test for the
// str_starts_with() TypeError in Tia::argumentPresent() — the same class
// of bug as #1206, which was only fixed in HandleArguments.
$arguments = ['--order-by=random', '--random-order-seed', 1782350398];
expect(Tia::isEnabledForRun($arguments))->toBeFalse();
});
test('still detects --tia when an integer argument is present', function () {
$arguments = ['--tia', '--random-order-seed', 1782350398];
expect(Tia::isEnabledForRun($arguments))->toBeTrue();
});
+2 -2
View File
@@ -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, 1353 passed (3015 assertions)';",
"\$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1372 passed (3044 assertions)';",
$file,
);
file_put_contents(__FILE__, $file);
}
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1353 passed (3015 assertions)';
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1372 passed (3044 assertions)';
expect($output)
->toContain("Tests: {$expected}")