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.46k stars 341 forks source link

[Bug]: Storing Feature tests nested in app folder in Laravel 11 throws ErrorException #1125

Closed dmlogic closed 5 months ago

dmlogic commented 6 months ago

What Happened

I've recently become a fan of tests being stored alongside the files they test. In a Laravel 10 project, I have numerous Feature tests in the app folder and make them bootstrap the framework by including uses(TestCase::class) at the top of each file.

This approach does not work in Laravel 11.

How to Reproduce

  1. File stored in tests/Unit/

This works:

test in unit folder

  1. File stored in app/

This also works:

test in app folder

  1. Create the folder app/Console/Commands/ and move the test into there

This throws an error exception:

test in nested folder

I've attempted to step through the code to narrow down the error. It's pretty deep and possibly thrown from phpUnit. The Laravel 11 project that does not work includes v10.5.15. The Laravel 10 project that does includes v10.5.13.

Sample Repository

No response

Pest Version

2.34.5

PHP Version

8.2.17

Operation System

Linux

Notes

No response

dmlogic commented 5 months ago

I've looked at this again a few weeks (and a few releases) later. The problem is no longer present using latest versions of everything