From 0fb259a373be4139f1b7e0d353146179ae68f9ec Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 27 May 2024 19:14:55 +0200 Subject: [PATCH] Return active and private from forms api --- app/Form/Resources/FormApiResource.php | 2 ++ tests/EndToEnd/Form/FormApiListActionTest.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Form/Resources/FormApiResource.php b/app/Form/Resources/FormApiResource.php index 0d23ac84..1af1d90b 100644 --- a/app/Form/Resources/FormApiResource.php +++ b/app/Form/Resources/FormApiResource.php @@ -33,6 +33,8 @@ class FormApiResource extends JsonResource 'slug' => $this->slug, 'dates' => $this->from->equalTo($this->to) ? $this->from->format('d.m.Y') : $this->from->format('d.m.Y') . ' - ' . $this->to->format('d.m.Y'), 'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'), + 'is_active' => $this->is_active, + 'is_private' => $this->is_private, ]; } diff --git a/tests/EndToEnd/Form/FormApiListActionTest.php b/tests/EndToEnd/Form/FormApiListActionTest.php index a7737d20..15bce7a9 100644 --- a/tests/EndToEnd/Form/FormApiListActionTest.php +++ b/tests/EndToEnd/Form/FormApiListActionTest.php @@ -84,7 +84,9 @@ class FormApiListActionTest extends FormTestCase sleep(1); $this->get('/api/form?perPage=15&filter=' . $this->filterString(['inactive' => true]))->assertJsonCount(3, 'data'); $this->get('/api/form?perPage=15&filter=' . $this->filterString(['inactive' => false]))->assertJsonCount(2, 'data'); - $this->get('/api/form?perPage=15&filter=' . $this->filterString([]))->assertJsonCount(2, 'data'); + $this->get('/api/form?perPage=15&filter=' . $this->filterString([]))->assertJsonCount(2, 'data') + ->assertJsonPath('data.0.is_active', true) + ->assertJsonPath('data.0.is_private', false); } public function testItDisplaysDailyForms(): void