Hello,
I have a few questions about mock in Livewire test files.
My UploadMedia
component uses a MediaService
i want mock.
$this->instance(
MediaService::class,
Mockery::mock(MediaService::class, function (MockInterface $mock) {
$mock->shouldReceive('store')
->andReturn('image_hash');
})
);
$component = Livewire::test(UploadMedia::class);
$component
->set('mediaType', 'image')
->set('media', $image)
->call('updated')
->assertEmitted('mediaUpdated');
However when i call updated
my mock doesn’t effect :
Mockery\Exception\InvalidCountException: Method store(<Any Arguments>) from Mockery_1__Tests_Livewire_Form_MediaService should be called
I have the feeling that Livewire::test
does not use the mock.
Any ideas?
Thx !