26 lines
656 B
PHP
26 lines
656 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Integration;
|
|
|
|
use Tests\Support\ApiTestCase;
|
|
use Tests\Support\DatabaseFixture;
|
|
|
|
final class QuestionnairesTest extends ApiTestCase
|
|
{
|
|
public function testRequiresAuth(): void
|
|
{
|
|
$res = $this->api('GET', 'questionnaires');
|
|
$this->assertLegacyAuthError($res, 401, 'Missing Bearer token');
|
|
}
|
|
|
|
public function testAdminCanListQuestionnaires(): void
|
|
{
|
|
$this->loginAs(DatabaseFixture::ADMIN_USERNAME);
|
|
$res = $this->api('GET', 'questionnaires');
|
|
$this->assertOk($res);
|
|
$this->assertNotEmpty($res['body']['data']['questionnaires'] ?? []);
|
|
}
|
|
}
|