Return active and private from forms api
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
philipp lang 2024-05-27 19:14:55 +02:00
parent e299e8b159
commit 0fb259a373
2 changed files with 5 additions and 1 deletions

View File

@ -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,
];
}

View File

@ -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