Fix index
This commit is contained in:
parent
4a452ef1fe
commit
79f818c0f9
|
@ -16,9 +16,9 @@ class TypeCast implements CastsAttributes
|
|||
*/
|
||||
public function get($model, string $key, $value, array $attributes)
|
||||
{
|
||||
$value = json_decode($value);
|
||||
$value = json_decode($value, true);
|
||||
|
||||
return new $value->cls($value->params);
|
||||
return app($value['cls'])->setParams($value['params']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ class MailmanType extends Type
|
|||
[
|
||||
'name' => 'password',
|
||||
'label' => 'Passwort',
|
||||
'type' => 'text',
|
||||
'type' => 'password',
|
||||
'storeValidator' => 'required|max:255',
|
||||
'updateValidator' => 'nullable|max:255',
|
||||
'default' => '',
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
<template v-for="(field, index) in getType(model.type.cls).fields">
|
||||
<f-text
|
||||
:key="index"
|
||||
v-if="field.type === 'text'"
|
||||
v-if="field.type === 'text' || field.type === 'password'"
|
||||
:label="field.label"
|
||||
:type="field.type"
|
||||
:name="field.name"
|
||||
:id="field.name"
|
||||
v-model="model.type.params[field.name]"
|
||||
|
|
|
@ -5,7 +5,10 @@ namespace Tests\Feature\Mailgateway;
|
|||
use App\Mailgateway\Models\Mailgateway;
|
||||
use App\Mailgateway\Types\LocalType;
|
||||
use App\Mailgateway\Types\MailmanType;
|
||||
use App\Mailman\Support\MailmanService;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Phake;
|
||||
use Tests\RequestFactories\MailmanTypeRequest;
|
||||
use Tests\TestCase;
|
||||
|
||||
class IndexTest extends TestCase
|
||||
|
@ -26,7 +29,7 @@ class IndexTest extends TestCase
|
|||
$response->assertOk();
|
||||
}
|
||||
|
||||
public function testItDisplaysGateways(): void
|
||||
public function testItDisplaysLocalGateways(): void
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
Mailgateway::factory()->type(LocalType::class, [])->name('Lore')->domain('example.com')->create();
|
||||
|
@ -39,6 +42,18 @@ class IndexTest extends TestCase
|
|||
$this->assertInertiaHas(true, $response, 'data.data.0.works');
|
||||
}
|
||||
|
||||
public function testItDisplaysMailmanGateways(): void
|
||||
{
|
||||
$this->stubIo(MailmanService::class, function ($mock) {
|
||||
Phake::when($mock)->setCredentials()->thenReturn($mock);
|
||||
Phake::when($mock)->check()->thenReturn(true);
|
||||
});
|
||||
$this->withoutExceptionHandling();
|
||||
Mailgateway::factory()->type(MailmanType::class, MailmanTypeRequest::new()->create())->create();
|
||||
|
||||
$this->get('/setting/mailgateway')->assertOk();
|
||||
}
|
||||
|
||||
public function testItHasMeta(): void
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
|
|
Loading…
Reference in New Issue