Skip to content

Fix repeat with named dataset arguments - #1769

Open
drewmt wants to merge 1 commit into
pestphp:5.xfrom
drewmt:fix/repeat-named-datasets
Open

Fix repeat with named dataset arguments#1769
drewmt wants to merge 1 commit into
pestphp:5.xfrom
drewmt:fix/repeat-named-datasets

Conversation

@drewmt

@drewmt drewmt commented Jul 24, 2026

Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

repeat() prepends its iteration value to the data provider arguments and later moves it to the end before invoking the test. With named dataset arguments, appending that value as a positional argument causes PHP to throw Cannot use positional argument after named argument.

This keeps the existing positional behavior, maps the iteration value to the next test parameter when named arguments are used, and omits it when the test does not accept an iteration parameter. Regression coverage includes both named datasets with and without the repeat iterator.

The aggregate visual snapshots are updated for the eight additional repeated executions and twenty assertions.

Related:

Fixes #1767

Validation:

  • php bin/pest tests/Features/Repeat.php --compact — 142 tests, 327 assertions
  • composer test:lint
  • composer test:type:check
  • Type coverage — 100%

The full local matrix was also attempted. Its remaining failures are limited to the existing macOS-specific Backtrace expectation and platform-dependent visual aggregate counts; the focused behavior, lint, static analysis, and type coverage pass.

@drewmt
drewmt marked this pull request as ready for review July 24, 2026 22:38
@drewmt
drewmt force-pushed the fix/repeat-named-datasets branch from 60e4173 to 85bacc9 Compare August 5, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to use repeat() with Named Parameters in Datasets

1 participant