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

Architecture expectations passing when they are expected to fail. #1148

Open
ghowardPI opened this issue May 2, 2024 · 2 comments
Open

Architecture expectations passing when they are expected to fail. #1148

ghowardPI opened this issue May 2, 2024 · 2 comments
Labels

Comments

@ghowardPI
Copy link

ghowardPI commented May 2, 2024

What Happened

Expect('App\Enums')->toBeEnums(); is passing although my App doesn't contain an Enums directory.
The test is executed in tests/Unit/ArchTest.php

pest
Pest2

How to Reproduce

I set up a fresh Laravel app and ran test('app')->expect('App\Enums')->toBeEnums(); inside tests/Unit/ArchTest.php, which passes. However the app does not contain the App\Enums directory.

Sample Repository

No response

Pest Version

2.34

PHP Version

8.2.6

Operation System

Windows

Notes

No response

@ghowardPI ghowardPI added the bug label May 2, 2024
@Katalam
Copy link

Katalam commented May 3, 2024

This is not a bug. If there is no directory, there are no classes/files, but at the same time all found classes/files are enums, so in theoretical terms the statement is correct. All files in App\Enums are Enums

@avenjamin
Copy link

@ghowardPI I ran into this as well but when I read the docs the parameter you pass to the expect() function is NOT a file path - it's a namespace.

So you can stick a file with namespace App\Enums into say the App\Models folder and it'll still be processed by your test.

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

No branches or pull requests

3 participants