2024-02-03 17:51:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Form;
|
|
|
|
|
|
|
|
use App\Form\Fields\DateField;
|
|
|
|
use App\Form\Models\Form;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\TestCase;
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
|
|
|
|
class FormUpdateActionTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
Storage::fake('temp');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testItSetsCustomAttributesOfFields(): void
|
|
|
|
{
|
|
|
|
$this->login()->loginNami()->withoutExceptionHandling();
|
|
|
|
$form = Form::factory()->create();
|
|
|
|
$payload = FormRequest::new()->sections([
|
|
|
|
FormtemplateSectionRequest::new()->fields([
|
2024-02-04 03:19:28 +01:00
|
|
|
FormtemplateFieldRequest::type(DateField::class)->state(['max_today' => true]),
|
2024-02-03 17:51:27 +01:00
|
|
|
])
|
|
|
|
])->create();
|
|
|
|
|
|
|
|
$this->patchJson(route('form.update', ['form' => $form]), $payload)
|
|
|
|
->assertOk();
|
|
|
|
|
|
|
|
$form = $form->fresh();
|
|
|
|
|
|
|
|
$this->assertTrue(data_get($form->config, 'sections.0.fields.0.max_today'));
|
|
|
|
}
|
|
|
|
}
|