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.48k stars 343 forks source link

[Bug]: Some Architecture tests works incorrectly with BypassFinals enabled #1103

Open Perf opened 7 months ago

Perf commented 7 months ago

What Happened

Together with installed package nunomaduro/mock-final-classes, which uses dg/bypass-finals under the hood, execution of the following test produces false result.

It doesn't matter if the class defined as final or not, the test always passes. The same situation happens when testing that class should not be readonly, due to the same reason.

test('entity classes should not be final')
    ->expect('App\Domain\Entity')
    ->classes()
    ->not->toBeFinal();

How to Reproduce

Sample Repository

No response

Pest Version

2.34.0

PHP Version

8.3.2

Operation System

Linux

Notes

Probably it should be somehow possible to disable dg/bypass-finals when running architecture tests.