2023-06-01 15:45:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Mailgateway;
|
|
|
|
|
|
|
|
use App\Mailgateway\Types\LocalType;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\RequestFactories\MailgatewayRequestFactory;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class StoreTest extends TestCase
|
|
|
|
{
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->login()->loginNami();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testItCanStoreALocalGateway(): void
|
|
|
|
{
|
|
|
|
$response = $this->post('/api/mailgateway', MailgatewayRequestFactory::new()->name('lala')->type(LocalType::class, [])->domain('example.com')->create());
|
|
|
|
|
|
|
|
$response->assertOk();
|
|
|
|
|
|
|
|
$this->assertDatabaseHas('mailgateways', [
|
|
|
|
'domain' => 'example.com',
|
|
|
|
'name' => 'lala',
|
2023-06-07 21:43:11 +02:00
|
|
|
'type' => json_encode([
|
|
|
|
'cls' => LocalType::class,
|
|
|
|
'params' => [],
|
|
|
|
]),
|
2023-06-01 15:45:02 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|