39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Mailgateway;
|
|
|
|
use Modules\Mailgateway\Models\Mailgateway;
|
|
use Modules\Mailgateway\Types\LocalType;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Livewire\Livewire;
|
|
use Modules\Mailgateway\Components\SettingView;
|
|
use Tests\RequestFactories\MailmanTypeRequest;
|
|
use Tests\TestCase;
|
|
|
|
uses(DatabaseTransactions::class);
|
|
uses(TestCase::class);
|
|
|
|
it('test it can view index page', function () {
|
|
test()->login()->loginNami();
|
|
test()->get('/setting/mailgateway')->assertSeeLivewire(SettingView::class);
|
|
});
|
|
|
|
it('test it displays local gateways', function () {
|
|
test()->withoutExceptionHandling()->login()->loginNami();
|
|
Mailgateway::factory()->type(LocalType::from([]))->name('Lore')->domain('example.com')->create();
|
|
|
|
Livewire::test(SettingView::class)
|
|
->assertSeeHtml('example.com')
|
|
->assertSeeHtml('Lore')
|
|
->assertSeeHtml('Lokal')
|
|
->assertSeeHtml('Verbindung erfolgreich');
|
|
});
|
|
|
|
it('displays mailman gateways', function () {
|
|
test()->withoutExceptionHandling()->login()->loginNami();
|
|
$typeParams = MailmanTypeRequest::new()->succeeds()->state(['url' => 'https://mailman.example.com', 'user' => 'user', 'password' => 'password', 'owner' => 'owner']);
|
|
Mailgateway::factory()->type($typeParams->toData())->create();
|
|
|
|
Livewire::test(SettingView::class)->assertSeeHtml('Verbindung erfolgreich');
|
|
});
|