added unit tests
This commit is contained in:
38
tests/Integration/AssignmentsActivityLogTest.php
Normal file
38
tests/Integration/AssignmentsActivityLogTest.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Integration;
|
||||
|
||||
use Tests\Support\DatabaseSeeder;
|
||||
use Tests\Support\QdbTestCase;
|
||||
|
||||
final class AssignmentsActivityLogTest extends QdbTestCase
|
||||
{
|
||||
public function testAssignmentsListForAdmin(): void
|
||||
{
|
||||
$token = $this->api()->loginWebAndGetToken(
|
||||
DatabaseSeeder::ADMIN_USERNAME,
|
||||
DatabaseSeeder::PASSWORD
|
||||
)['token'];
|
||||
$res = $this->api()->withToken($token, 'GET', 'assignments');
|
||||
$this->assertApiOk($res);
|
||||
$this->assertArrayHasKey('coaches', $res['data']);
|
||||
$this->assertArrayHasKey('clients', $res['data']);
|
||||
}
|
||||
|
||||
public function testActivityLogReadableByAdmin(): void
|
||||
{
|
||||
$token = $this->api()->loginWebAndGetToken(
|
||||
DatabaseSeeder::ADMIN_USERNAME,
|
||||
DatabaseSeeder::PASSWORD
|
||||
)['token'];
|
||||
$today = gmdate('Y-m-d');
|
||||
$res = $this->api()->withToken($token, 'GET', 'activity-log', null, [
|
||||
'date' => $today,
|
||||
'limit' => '50',
|
||||
]);
|
||||
$this->assertApiOk($res);
|
||||
$this->assertArrayHasKey('entries', $res['data']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user