pest icon indicating copy to clipboard operation
pest copied to clipboard

[Bug]: PHPUnit namespace connot be used in architecture tests?

Open parijke opened this issue 1 year ago • 0 comments

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

parijke avatar Nov 20 '24 07:11 parijke