lundi 16 novembre 2020

Laravel spatie/responsecache not throwing events when clearing cache

I'm using laravel 8 with spatie/laravel-responsecache 6.6.5.

This package should throw 2 events whenever the response cache is cleared. After running the following in tinker I have determined that it is not. I would like this for testing purposes and would like to know if anyone has an idea why before I submit an issue. I have verified that the response cache is being cleared when I call the function ResponseCache::clear().

# php artisan tinker
>>> use \Spatie\ResponseCache\Facades\ResponseCache;
>>> \Event::fake()
=> Illuminate\Support\Testing\Fakes\EventFake {#3545}
>>> use \Spatie\ResponseCache\Facades\ResponseCache;
>>> ResponseCache::clear() # Responsecache is cleared
=> null
>>> Event::assertDispatched(\Spatie\ResponseCache\Events\ClearingResponseCache::class)
PHPUnit/Framework/ExpectationFailedException with message 'The expected [Spatie/ResponseCache/Events/ClearingResponseCache] event was not dispatched.
Failed asserting that false is true.'
>>> Event::assertDispatched(\Spatie\ResponseCache\Events\ClearedResponseCache::class)
PHPUnit/Framework/ExpectationFailedException with message 'The expected [Spatie/ResponseCache/Events/ClearedResponseCache] event was not dispatched.
Failed asserting that false is true.'

Aucun commentaire:

Enregistrer un commentaire