PHP code example of remarkablemark / rector-laravel-service-mocking
1. Go to this page and download the library: Download remarkablemark/rector-laravel-service-mocking 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/ */
remarkablemark / rector-laravel-service-mocking example snippets
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Remarkablemark\RectorLaravelServiceMocking\LaravelServiceMockingRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/tests',
]);
$rectorConfig->rule(LaravelServiceMockingRector::class);
};
vendor/bin/rector process --dry-run
vendor/bin/rector process
vendor/bin/rector process --clear-cache
$this->expectsEvents([MyEvent::class]);
\Illuminate\Support\Facades\Event::fake([MyEvent::class])->assertDispatched([MyEvent::class]);
Event::fake([MyEvent::class]);
// dispatch your event here...
Event::assertDispatched(MyEvent::class);
Event::fake([MyEvent1::class, MyEvent2::class]);
// ...
Event::assertDispatched(MyEvent1::class);
Event::assertDispatched(MyEvent2::class);