pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.06k stars 313 forks source link

[Bug]: Performance issue with `->not->toBeNull()` #1137

Open cborgas opened 2 months ago

cborgas commented 2 months ago

What Happened

When I use expect($someEntity)->not->toBeNull() I'm noticing significant performance issues. I'm running "integration" tests with symfony and doctrine and asserting on doctrine entities. In some cases using not->toBeNull() will take upwards of 40s and removing it can reduce it to ~10s.

How to Reproduce

In a symfony application, write a pest test that extends symfonys BaseWebTestCase (docs here https://symfony.com/doc/current/testing.html#write-your-first-application-test) and write a test that asserts a doctrine entity exists.

Sample Repository

No response

Pest Version

2.31.0

PHP Version

8.2.15

Operation System

Linux

Notes

No response