pest
pest copied to clipboard
[Bug]: PHPUnit namespace connot be used in architecture tests?
What Happened
I have two architecture tests to prevent usage in the code base. These are:
arch('ensures Eloquent Collections are only used in Repository namespace')
->expect('Illuminate\Database\Eloquent\Collection')
->toOnlyBeUsedIn('App\Repositories');
arch('ensures PHPUnit namespace is not used in App namespace')
->expect('PHPUnit\Framework\Assert')
->toOnlyBeUsedIn('App\Repositories');
The test with the Collection works as expected, as usage of PHPUnit\Framework\Assert remains undetected
How to Reproduce
Use PHPUnit\Framework\Assert somewhere else than App\Repositories
Sample Repository
No response
Pest Version
3.5.1
PHP Version
8.3.13
Operation System
Linux
Notes
No response