Add non nami members
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2024-06-18 02:00:36 +02:00
parent fa2d93174a
commit 3f3ecf0071
2 changed files with 16 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class NamiField extends Field
}
return [
$this->key . '.*.id' => ['required', 'numeric', 'exists:members,mitgliedsnr'],
$this->key . '.*.id' => ['nullable', 'numeric', 'exists:members,mitgliedsnr'],
...$rules,
];
}

View File

@ -556,6 +556,21 @@ class FormRegisterActionTest extends FormTestCase
$this->assertEquals('othervalue', $form->participants->get(1)->data['other']);
}
public function testItAddsMemberForNonNami(): void
{
$this->login()->loginNami();
$this->createMember(['mitgliedsnr' => '5505']);
$form = Form::factory()->fields([
$this->namiField('members'),
$this->textField('other')->required(false),
])
->create();
$this->register($form, ['other' => '::string::', 'members' => [['id' => null, 'other' => 'othervalue']]])
->assertOk();
$this->assertEquals('othervalue', $form->participants->get(1)->data['other']);
}
public function testItValidatesMembersFields(): void
{
$this->login()->loginNami();