This commit is contained in:
49
tests/Integration/ClientsTest.php
Normal file
49
tests/Integration/ClientsTest.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
|
||||
namespace Tests\Integration;
|
||||
|
||||
|
||||
|
||||
use Tests\Support\ApiTestCase;
|
||||
|
||||
use Tests\Support\DatabaseFixture;
|
||||
|
||||
|
||||
|
||||
final class ClientsTest extends ApiTestCase
|
||||
|
||||
{
|
||||
|
||||
public function testRequiresAuth(): void
|
||||
|
||||
{
|
||||
|
||||
$res = $this->api('GET', 'clients');
|
||||
|
||||
$this->assertLegacyAuthError($res, 401, 'Missing Bearer token');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAdminSeesAllClients(): void
|
||||
|
||||
{
|
||||
|
||||
$this->loginAs(DatabaseFixture::ADMIN_USERNAME);
|
||||
|
||||
$res = $this->api('GET', 'clients');
|
||||
|
||||
$this->assertOk($res);
|
||||
|
||||
$codes = array_column($res['body']['data']['clients'], 'clientCode');
|
||||
|
||||
$this->assertContains(DatabaseFixture::CLIENT_COACH1, $codes);
|
||||
|
||||
$this->assertContains(DatabaseFixture::CLIENT_COACH2, $codes);
|
||||
Reference in New Issue
Block a user