'setting'], ['value' => json_encode(['company' => 'Thế Giới Số'])]); Setting::updateOrCreate(['key' => 'smtp'], ['value' => json_encode([ 'host' => $host, 'port' => 465, 'user' => 'noreply@tgs.com.vn', 'password' => SignRSA::EncryptFunc('secret'), 'encryption' => 'ssl', 'from_address' => 'noreply@tgs.com.vn', 'from_name' => 'TGS', ])]); Cache::forget(MailSettings::cacheKey()); } private function hostSeenByQueuedJob(): ?string { dispatch(fn () => Cache::put('test:queued-mail-host', config('mail.mailers.smtp.host'))); return Cache::pull('test:queued-mail-host'); } public function test_queued_jobs_use_smtp_from_settings_and_pick_up_changes(): void { config(['queue.default' => 'sync']); $this->saveSmtp('smtp.settings-one.test'); $this->assertSame('smtp.settings-one.test', $this->hostSeenByQueuedJob()); $this->assertSame('noreply@tgs.com.vn', config('mail.from.address')); $this->assertSame('secret', config('mail.mailers.smtp.password')); $this->saveSmtp('smtp.settings-two.test'); $this->assertSame('smtp.settings-two.test', $this->hostSeenByQueuedJob()); } }