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

[Bug]: toOnlyUse not working as documented in the Pest Docs #973

Open
spont4e opened this issue Oct 2, 2023 · 2 comments · May be fixed by pestphp/pest-plugin-arch#10
Open

[Bug]: toOnlyUse not working as documented in the Pest Docs #973

spont4e opened this issue Oct 2, 2023 · 2 comments · May be fixed by pestphp/pest-plugin-arch#10

Comments

@spont4e
Copy link

spont4e commented Oct 2, 2023

What Happened

When I used either the toOnlyUse examples even directly copied from the docs, it returns this exception.

How to Reproduce

  1. Install a fresh laravel app with pest
  2. 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

@spont4e spont4e added the bug label Oct 2, 2023
@devajmeireles
Copy link
Member

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.

@wblondel
Copy link

Hello,

Is help still wanted on this issue? It seems PR pestphp/pest-plugin-arch#10 from December 2023 fixes the issue. It would be great to have it merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants