feat(admin): improve payments and server settings
This commit is contained in:
@@ -7,8 +7,11 @@ namespace Tests\Feature\Mail;
|
||||
use App\Http\Facade\SignRSA;
|
||||
use App\Models\Setting;
|
||||
use App\Support\MailSettings;
|
||||
use App\Listeners\Mail\ApplySystemRecipients;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Mail\Events\MessageSending;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Tests\TestCase;
|
||||
|
||||
class MailSettingsQueueTest extends TestCase
|
||||
@@ -45,4 +48,21 @@ class MailSettingsQueueTest extends TestCase
|
||||
$this->saveSmtp('smtp.settings-two.test');
|
||||
$this->assertSame('smtp.settings-two.test', $this->hostSeenByQueuedJob());
|
||||
}
|
||||
|
||||
public function test_system_cc_and_bcc_are_applied_without_duplicate_recipients(): void
|
||||
{
|
||||
$this->saveSmtp('smtp.settings.test');
|
||||
$smtp = Setting::where('key', 'smtp')->firstOrFail();
|
||||
$values = json_decode((string) $smtp->value, true);
|
||||
$values['cc'] = ['audit@example.com', 'customer@example.com'];
|
||||
$values['bcc'] = ['archive@example.com', 'audit@example.com'];
|
||||
$smtp->update(['value' => json_encode($values)]);
|
||||
Cache::forget(MailSettings::cacheKey());
|
||||
|
||||
$message = (new Email())->to('customer@example.com')->subject('Test');
|
||||
app(ApplySystemRecipients::class)->handle(new MessageSending($message, []));
|
||||
|
||||
$this->assertSame(['audit@example.com'], array_map(fn ($address) => $address->getAddress(), $message->getCc()));
|
||||
$this->assertSame(['archive@example.com'], array_map(fn ($address) => $address->getAddress(), $message->getBcc()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user