[4.x] Wildcard (*) for partial file names in architecture tests not supported
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
What Happened
We have the following architecture tests in our Laravel app:
arch('json resources')
->expect('App\Http\Resources\*Resource')
->toExtend('Illuminate\Http\Resources\Json\JsonResource');
arch('json resource collections')
->expect('App\Http\Resources\*ResourceCollection')
->toExtend('Illuminate\Http\Resources\Json\ResourceCollection');
Previously, this test was passing (we just upgraded from 3.7.4). As of the latest update, this throws a DirectoryNotFoundException, saying 'The "[redacted]../app/Http/Resources/*Resource" directory does not exist'.
How to Reproduce
Install a fresh Laravel app, add Pest (3.8.1), add a file directory App\Http\Resources, with a class in it that uses the "Resource" suffix and extends Illuminate\Http\Resources\Json\JsonResource.
Add the following architecture test:
arch('json resources')
->expect('App\Http\Resources\*Resource')
->toExtend('Illuminate\Http\Resources\Json\JsonResource');
Sample Repository
No response
Pest Version
3.8.1
PHP Version
8.4.2
Operation System
macOS
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the architecture test in a fresh Laravel app with Pest 3.8.1, using an App\Http\Resources class whose name ends in Resource. Trace how the wildcard expectation path is handled and verify that the test passes without a DirectoryNotFoundException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100