Repository navigation
Conversation
Handle exact-empty and last-wins messages, normalize named expectation arguments, and keep argument snapshots across assignments. Add transformed runtime controls and document independent dynamic regex limits. Refs php-testo#389 Assisted-By: GPT-6 <noreply@anthropic.com>
Run converted fixtures through a nested application instead of a subprocess and JSON/JUnit reports. Remove the redundant message flag and restore unsupported runs from the original statement range. Refs php-testo#389 Assisted-By: GPT-6 <noreply@anthropic.com>
Add an optional exact comparison mode to withMessage so migrations can replace substring expectations without PCRE length limits. Retain exact matching by default and keep regex constraints independent. Cover long messages and mode changes through transformed runtime controls, native PHPUnit parity, and the Assert suites. Document the API and handle literal modes in the reverse conversion. Refs php-testo#389 Assisted-By: GPT-6 <noreply@anthropic.com>
Preserve repeated message modes in reverse migrations and reserve handler names across the containing function, including conditional and later locals. Leave extract-based dynamic locals for manual migration. Keep provably nonempty messages readable, remove adjacent overwritten literals only when safe, and pass comparison modes by name so older Assert versions reject unsupported output explicitly. Move runtime controls to the Feature suite, check individual verdicts and assertion counts, and cover weak/strict coercion and assignments that throw. Document generated-code compatibility and the public Assert API requirement. Refs php-testo#389 Assisted-By: GPT-6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHPUnit requires an exactly empty exception message, replaces earlier message expectations, and accepts named
exception:arguments. Preserve these contracts during migration, including argument coercion, evaluation order and captured values across assignments.Add the public
ExpectedException::withMessage(string $message, bool $exact = true)comparison mode.exact: falseusesstr_contains()and replaces the previous message and mode; existing calls remain exact.withMessageContaining()continues to accumulate substrings. This removes the PCRE length limit for dynamic/repeated messages while keeping independent regex constraints intact.Rector keeps provably nonempty messages simple and removes adjacent overwritten literals when safe. Other arguments are evaluated/coerced once through a typed closure, with the comparison flag passed by name even inside spread arguments. Handler names reserve conditional and later locals across the containing function; dynamic locals from
extract()stay manual. The reverse rule leaves repeatedwithMessage()modes unchanged when PHPUnit cannot preserve their replacement semantics.Generated-code compatibility: the target project needs the Assert API above before running migrations that emit
exact. This API is introduced by this PR and needs an Assert release before consumers can use the new bridge output. Until then, use matching Assert code from the same checkout. An older Assert now reportsUnknown named parameter $exactinstead of silently ignoring a positional flag. The bridge's development dependencies do not constrain a separately installed target project. The PR is markedfeatbecause it adds public Assert API.Validation on the final change:
PHPUNIT_TO_TESTOset and real PHPUnit reflection preserves all verdicts; auxiliary trace checks use Testo assertions. Testo records 28 assertions and PHPUnit records 56.withMessage()signature explicitly on PHP 8.2, 8.3 and 8.5.git diff --checkpasses. Fullcomposer cs:diffpreviously reported a pre-existing difference in unmodifiedcore/Output/Terminal/Renderer/ColorMode.phpon Windows.PHP compatibility: the minimum remains PHP 8.2. Runtime platform checks and the isolated Rector dependency check pass on PHP 8.2.34. The full development dependency check on 8.2 fails because the existing locked
infection/abstract-testframework-adapter0.5.1 requires PHP^8.3; Composer requirements and lockfiles are unchanged.Fixes #389.