29 lines
850 B
PHP
29 lines
850 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use App\Models\EmailSetting;
|
||
|
|
use App\Models\User;
|
||
|
|
|
||
|
|
beforeEach(function () {
|
||
|
|
EmailSetting::where('imap_host', 'test.feature')->delete();
|
||
|
|
});
|
||
|
|
|
||
|
|
it('saves email settings via POST form', function () {
|
||
|
|
$user = User::first();
|
||
|
|
$response = $this->actingAs($user)->post(route('impostazioni.email.save'), [
|
||
|
|
'imap_host' => 'test.feature',
|
||
|
|
'imap_port' => '993',
|
||
|
|
'imap_encryption' => 'ssl',
|
||
|
|
'imap_username' => 'featureuser',
|
||
|
|
'imap_password' => 'featurepass',
|
||
|
|
'email_address' => 'feature@test.com',
|
||
|
|
'email_name' => 'Feature Test',
|
||
|
|
'is_active' => '1',
|
||
|
|
]);
|
||
|
|
|
||
|
|
$response->assertSessionHas('success');
|
||
|
|
|
||
|
|
$record = EmailSetting::where('imap_host', 'test.feature')->first();
|
||
|
|
expect($record)->not->toBeNull();
|
||
|
|
expect($record->email_address)->toBe('feature@test.com');
|
||
|
|
});
|