pest
pest copied to clipboard
[Bug]: toOnlyUse not working as documented in the Pest Docs
What Happened
When I used either the toOnlyUse examples even directly copied from the docs, it returns this exception.
How to Reproduce
- Install a fresh laravel app with pest
- Replace Feature\ExampleTest with the following basically clipped from the docs
<?php
test('models')
->expect('App\Models')
->toOnlyUse('Illuminate\Database');
Exception stacktrace
ErrorException: Attempt to read property "stmts" on null
at vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:254
at vendor/pestphp/pest-plugin-arch/src/Blueprint.php:235
at vendor/pestphp/pest-plugin-arch/src/Blueprint.php:148
at vendor/pestphp/pest-plugin-arch/src/Expectations/ToOnlyUse.php:37
at vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:156
at vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:140
at vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:174
Tests: 1 failed (1 assertions)
Duration: 1.76s
Process finished with exit code 2
Sample Repository
No response
Pest Version
2.19.2
PHP Version
8.2.10
Operation System
Linux
Notes
No response
Hey, @spont4e . Thanks for your report.
I was able to reproduce that. I will investigate the issue. Feel free to open a PR fixing this issue.