mirror of
https://github.com/pestphp/pest.git
synced 2026-04-21 14:37:29 +02:00
fix: preserve full error message in not() expectation failures
When using not() expectations with custom error messages, the message was truncated because throwExpectationFailedException() passed all arguments through shortenedExport() which limits strings to ~40 chars. Uses the full export() method for arguments instead of shortenedExport() so custom error messages are displayed in their entirety. Fixes #1533
This commit is contained in:
@ -86,4 +86,17 @@ final readonly class Exporter
|
||||
|
||||
return (string) preg_replace(array_keys($map), array_values($map), $this->exporter->shortenedExport($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports a value into a full single-line string without truncation.
|
||||
*/
|
||||
public function export(mixed $value): string
|
||||
{
|
||||
$map = [
|
||||
'#\\\n\s*#' => '',
|
||||
'# Object \(\.{3}\)#' => '',
|
||||
];
|
||||
|
||||
return (string) preg_replace(array_keys($map), array_values($map), $this->exporter->export($value));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user