mirror of
https://github.com/archtechx/tenancy-queue-tester.git
synced 2025-12-12 10:04:02 +00:00
add persistence, sync, and forceRefresh assertions
This commit is contained in:
parent
fd830beaf7
commit
6a047d3686
10 changed files with 562 additions and 29 deletions
35
setup/alternative/AppServiceProvider.php
Executable file
35
setup/alternative/AppServiceProvider.php
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Queue\Console\RestartCommand;
|
||||
use Illuminate\Queue\Console\WorkCommand;
|
||||
use Illuminate\Queue\Events\JobProcessed;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->extend(RestartCommand::class, function ($_, $app) {
|
||||
return new RestartCommand($app['cache']->store('global_redis'));
|
||||
});
|
||||
$this->app->extend(WorkCommand::class, function ($_, $app) {
|
||||
return new WorkCommand($app['queue.worker'], $app['cache']->store('global_redis'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Event::listen(JobProcessed::class, function () {
|
||||
file_put_contents(base_path('jobprocessed_context'), tenant() ? ('tenant_' . tenant('id')) : 'central');
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue