Update content tests
This commit is contained in:
parent
fde1a9d169
commit
2abe061c4f
|
@ -28,8 +28,8 @@ class FormStoreAction
|
|||
'to' => 'required|date',
|
||||
'registration_from' => 'present|nullable|date',
|
||||
'registration_until' => 'present|nullable|date',
|
||||
'mail_top' => 'nullable|string',
|
||||
'mail_bottom' => 'nullable|string',
|
||||
'mail_top' => 'array',
|
||||
'mail_bottom' => 'array',
|
||||
'header_image' => 'required|exclude',
|
||||
'mailattachments' => 'present|array|exclude',
|
||||
];
|
||||
|
|
|
@ -29,8 +29,8 @@ class FormUpdateAction
|
|||
'to' => 'required|date',
|
||||
'registration_from' => 'present|nullable|date',
|
||||
'registration_until' => 'present|nullable|date',
|
||||
'mail_top' => 'nullable|string',
|
||||
'mail_bottom' => 'nullable|string',
|
||||
'mail_top' => 'array',
|
||||
'mail_bottom' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ class Form extends Model implements HasMedia
|
|||
'config' => FormConfigData::class,
|
||||
'meta' => 'json',
|
||||
'description' => 'json',
|
||||
'mail_top' => 'json',
|
||||
'mail_bottom' => 'json',
|
||||
];
|
||||
|
||||
/** @var array<int, string> */
|
||||
|
|
|
@ -77,8 +77,8 @@ class FormResource extends JsonResource
|
|||
'to' => null,
|
||||
'registration_from' => null,
|
||||
'registration_until' => null,
|
||||
'mail_top' => null,
|
||||
'mail_bottom' => null,
|
||||
'mail_top' => [],
|
||||
'mail_bottom' => [],
|
||||
'config' => null,
|
||||
'header_image' => null,
|
||||
'mailattachments' => [],
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Form\Mails\ConfirmRegistrationMail;
|
|||
use App\Form\Models\Form;
|
||||
use App\Form\Models\Participant;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\RequestFactories\EditorRequestFactory;
|
||||
|
||||
class FormRegisterMailTest extends FormTestCase
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ class FormRegisterMailTest extends FormTestCase
|
|||
])
|
||||
])
|
||||
|
||||
->mailTop('mail top')->mailBottom('mail bottom')
|
||||
->mailTop(EditorRequestFactory::new()->text(10, 'mail top'))->mailBottom(EditorRequestFactory::new()->text(11, 'mail bottom'))
|
||||
)
|
||||
->data(['vorname' => 'Max', 'nachname' => 'Muster'])
|
||||
->create();
|
||||
|
|
|
@ -12,8 +12,8 @@ use Worksome\RequestFactories\RequestFactory;
|
|||
* @method self from(string $date)
|
||||
* @method self to(string $date)
|
||||
* @method self description(?EditorRequestFactory $description)
|
||||
* @method self mailTop(string $content)
|
||||
* @method self mailBottom(string $content)
|
||||
* @method self mailTop(?EditorRequestFactory $content)
|
||||
* @method self mailBottom(?EditorRequestFactory $content)
|
||||
* @method self excerpt(string $description)
|
||||
* @method self registrationFrom(string|null $date)
|
||||
* @method self registrationUntil(string|null $date)
|
||||
|
@ -40,8 +40,8 @@ class FormRequest extends RequestFactory
|
|||
'to' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
||||
'registration_from' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
||||
'registration_until' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
||||
'mail_top' => $this->faker->text(),
|
||||
'mail_bottom' => $this->faker->text(),
|
||||
'mail_top' => EditorRequestFactory::new()->create(),
|
||||
'mail_bottom' => EditorRequestFactory::new()->create(),
|
||||
'header_image' => $this->getHeaderImagePayload(str()->uuid() . '.jpg'),
|
||||
'mailattachments' => [],
|
||||
];
|
||||
|
|
|
@ -26,8 +26,8 @@ class FormStoreActionTest extends FormTestCase
|
|||
->description($description)
|
||||
->excerpt('avff')
|
||||
->registrationFrom('2023-05-04 01:00:00')->registrationUntil('2023-07-07 01:00:00')->from('2023-07-07')->to('2023-07-08')
|
||||
->mailTop('Guten Tag')
|
||||
->mailBottom('Viele Grüße')
|
||||
->mailTop(EditorRequestFactory::new()->text(11, 'lala'))
|
||||
->mailBottom(EditorRequestFactory::new()->text(12, 'lalab'))
|
||||
->headerImage('htzz.jpg')
|
||||
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()->namiType(NamiType::BIRTHDAY)->forMembers(false)->hint('hhh')])])
|
||||
->fake();
|
||||
|
@ -39,8 +39,8 @@ class FormStoreActionTest extends FormTestCase
|
|||
$this->assertEquals('formname', $form->name);
|
||||
$this->assertEquals('avff', $form->excerpt);
|
||||
$this->assertEquals($description->paragraphBlock(10, 'Lorem'), $form->description);
|
||||
$this->assertEquals('Guten Tag', $form->mail_top);
|
||||
$this->assertEquals('Viele Grüße', $form->mail_bottom);
|
||||
$this->assertEquals(json_decode('{"time":1,"blocks":[{"id":11,"type":"paragraph","data":{"text":"lala"}}],"version":"1.0"}', true), $form->mail_top);
|
||||
$this->assertEquals(json_decode('{"time":1,"blocks":[{"id":12,"type":"paragraph","data":{"text":"lalab"}}],"version":"1.0"}', true), $form->mail_bottom);
|
||||
$this->assertEquals('2023-05-04 01:00', $form->registration_from->format('Y-m-d H:i'));
|
||||
$this->assertEquals('2023-07-07 01:00', $form->registration_until->format('Y-m-d H:i'));
|
||||
$this->assertEquals('2023-07-07', $form->from->format('Y-m-d'));
|
||||
|
|
Loading…
Reference in New Issue