40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Tests\Feature\Mailgateway;
|
||
|
|
||
|
use App\Mailgateway\Models\Mailgateway;
|
||
|
use App\Mailgateway\Types\LocalType;
|
||
|
use App\Mailgateway\Types\MailmanType;
|
||
|
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::class, [])->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()->create(['url' => 'https://mailman.example.com', 'user' => 'user', 'password' => 'password', 'owner' => 'owner']);
|
||
|
Mailgateway::factory()->type(MailmanType::class, $typeParams)->create();
|
||
|
|
||
|
Livewire::test(SettingView::class)->assertSeeHtml('Verbindung erfolgreich');
|
||
|
});
|