Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not export data passed to test for PHPUnit\Event\Code\TestMethod value object by default #5524

Closed
sebastianbergmann opened this issue Sep 24, 2023 · 3 comments
Assignees
Labels
feature/data-provider Data Providers feature/events Issues related to PHPUnit's event system feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory)
Milestone

Comments

@sebastianbergmann
Copy link
Owner

The data provided to a test by a data provider (or by another test methods through test dependencies) is exported to a string for the value object that represents the test for the event system. This export is performed using sebastian/exporter.

PHPUnit's own event subscribers do not use this exported data, the export can therefore be made optional. This would be similar to what we did in #5515 for the Test\AssertionSucceeded and Test\AssertionFailed events.

Motivated by phpstan/phpstan#9914.

@gnutix
Copy link

gnutix commented Sep 25, 2023

@sebastianbergmann In order to try this patch, I've upgraded PHPUnit to 10.4.x locally, and stumbled upon the following error.

PHP Fatal error: Declaration of DMS\PHPUnitExtensions\ArraySubset\Constraint\ArraySubset::toString(): string must be compatible with PHPUnit\Framework\Constraint\Constraint::toString(bool $exportObjects = false): string in vendor/dms/phpunit-arraysubset-asserts/src/Constraint/ArraySubset.php on line 108

I've had other examples in Symfony code (like in Symfony\Component\Mailer\Test\Constraint\EmailCount). So I'm wondering if there should be a mention in 10.4 changelog about this BC break ?

@sebastianbergmann
Copy link
Owner Author

You would be correct if I planned to release PHPUnit 10.4 with this BC break :)

@gnutix
Copy link

gnutix commented Sep 25, 2023

Okay, good to know you were aware of it and it's not meant to stay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/data-provider Data Providers feature/events Issues related to PHPUnit's event system feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory)
Projects
None yet
Development

No branches or pull requests

2 participants