register fake driver at service provider#336
Conversation
There was a problem hiding this comment.
Review Summary
This PR successfully refactors the fake driver registration to use Laravel's service container instead of direct instantiation, which improves extensibility and follows Laravel best practices.
Key Changes:
- ✅ Added
PigeonFakeregistration as singleton inPigeonServiceProvider - ✅ Updated
Pigeon::fake()to resolve from container usingapp('pigeon-fake') - ✅ Proper import added for
PigeonFakeclass
Action Required:
- Update the
provides()method to include 'pigeon-fake' for proper service discovery
The implementation is solid and maintains backward compatibility while improving the architecture. Once the provides() method is updated, this will be ready to merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| $this->app->singleton('pigeon-fake', static function ($app) { | ||
| return new PigeonFake($app); | ||
| }); |
There was a problem hiding this comment.
Since you're now registering 'pigeon-fake' as a singleton in this service provider, you should also add it to the provides() method return array. The method currently only returns ['pigeon'] but should return ['pigeon', 'pigeon-fake'] to ensure proper service discovery when the provider is deferred.
Description
The fake driver should be registered at ServiceProvider to be extensible and swapable.
This MR juster resolve the fake driver at service container instead of using
newstatement.This MR is not a BC