Open challet opened 7 years ago
As of Codeception 3.0.2
this still appears to be a problem.
I agree that this is unexpected behaviour from a user's perspective, and it's not ideal to not be able to use the Laravel framework's built in test helpers.
A quick one liner I found that can be used as a workaround with the Queue facade is the following:
$I->haveInstance('queue', Queue::fake());
Note that you'll have to replace the 'queue' string here with the relevant facade accessor for the facade which you are using. (We can't just call getFacadeAccessor()
on the facade because it's protected.
Hi,
Using the Laravel module for testing a website, the Notification facade is firstly set to be a mock. Then, when sending a request, this setting is unset through a call to Facade::clearResolvedInstances().
Here is an extract from the stack trace :
And here is a sample code leading to it :
Leading to the final error :
[Error] Call to undefined method Illuminate\Notifications\Channels\MailChannel::assertSentTo()
("ChannelManager" looks inside "MailChannel" if it doesn't have the method)Notification::fake
couldn't be called again since it creates a new instance and would lose the previous data.