1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 15:34:04 +00:00

Central queues

This commit is contained in:
Samuel Štancl 2019-10-17 18:55:39 +02:00
parent 58fbdd5281
commit 2641fae3a3
2 changed files with 25 additions and 3 deletions

View file

@ -33,6 +33,24 @@ class QueueTest extends TestCase
return $event->job->payload()['tenant_id'] === tenant('id');
});
}
/** @test */
public function tenancy_is_not_initialized_in_non_tenant_queues()
{
$this->loadLaravelMigrations(['--database' => 'tenant']);
Event::fake();
config(['queue.connections.central' => [
'driver' => 'sync',
'tenancy' => false,
]]);
dispatch(new TestJob())->onConnection('central');
Event::assertDispatched(JobProcessing::class, function ($event) {
return ! isset($event->job->payload()['tenant_id']);
});
}
}
class TestJob implements ShouldQueue