From c62f8ec676256234b9fb9145a4c5ad4a2662a002 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 15 Apr 2024 16:37:36 +0200 Subject: [PATCH] Fixed tests --- app/Form/Resources/ParticipantResource.php | 26 ++++++++++--------- .../Feature/Form/FormtemplateFieldRequest.php | 2 ++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/Form/Resources/ParticipantResource.php b/app/Form/Resources/ParticipantResource.php index 1bf96e71..2e300cba 100644 --- a/app/Form/Resources/ParticipantResource.php +++ b/app/Form/Resources/ParticipantResource.php @@ -5,6 +5,7 @@ namespace App\Form\Resources; use App\Form\Models\Form; use App\Form\Models\Participant; use Illuminate\Http\Resources\Json\JsonResource; +use Illuminate\Support\Collection; /** * @mixin Participant @@ -31,23 +32,24 @@ class ParticipantResource extends JsonResource */ public static function meta(Form $form): array { + /** @var Collection> */ + $fieldData = $form->getFields() + ->map(fn ($field) => [ + 'name' => $field->name, + 'base_type' => class_basename($field), + 'id' => $field->key, + 'display_attribute' => $field->getDisplayAttribute(), + ]); return [ 'form_meta' => $form->meta, 'links' => [ 'update_form_meta' => route('form.update-meta', ['form' => $form]), ], - 'columns' => $form->getFields() - ->map(fn ($field) => [ - 'name' => $field->name, - 'base_type' => class_basename($field), - 'id' => $field->key, - 'display_attribute' => $field->getDisplayAttribute(), - ]) - ->push([ - 'name' => 'Registriert am', - 'id' => 'created_at', - 'display_attribute' => 'created_at_display' - ]) + 'columns' => $fieldData->push([ + 'name' => 'Registriert am', + 'id' => 'created_at', + 'display_attribute' => 'created_at_display' + ]) ]; } } diff --git a/tests/Feature/Form/FormtemplateFieldRequest.php b/tests/Feature/Form/FormtemplateFieldRequest.php index beeede3b..51683832 100644 --- a/tests/Feature/Form/FormtemplateFieldRequest.php +++ b/tests/Feature/Form/FormtemplateFieldRequest.php @@ -22,6 +22,8 @@ use App\Form\Enums\SpecialType; * @method self forMembers(bool $forMembers) * @method self specialType(SpecialType $specialType) * @method self hint(string $hint) + * @method self min(int $min) + * @method self max(int $max) */ class FormtemplateFieldRequest extends RequestFactory {