PHP code example of score-labs / laravel-event-fake

1. Go to this page and download the library: Download score-labs/laravel-event-fake library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

score-labs / laravel-event-fake example snippets


use ScoreLabs\Event; // full namespace
use Event; // overwritten alias via laravel auto-discovery

Event::fakeExcept(EventThatIWantToFire::class);

Event::fakeExcept(EventThatIWantToFire::class, TheOnlyListenerIWantToFire::class);

Event::assertHandled(AnotherListener::class);
// or 
Event::assertHandled(AnotherListener::class, function ($event) {
    return $event instanceof EventIWantToFire;
});

Event::fakeExceptModels();