This commit is contained in:
@ -91,43 +91,6 @@ final class ClientsLifecycleTest extends QdbTestCase
|
||||
$this->assertContains($code, array_column($activeAgain['data']['clients'], 'clientCode'));
|
||||
}
|
||||
|
||||
public function testAdminResetsClient(): void
|
||||
{
|
||||
$this->submitFixtureQuestionnaire();
|
||||
$token = $this->api()->loginWebAndGetToken(
|
||||
DatabaseSeeder::ADMIN_USERNAME,
|
||||
DatabaseSeeder::PASSWORD
|
||||
)['token'];
|
||||
$code = $this->fixture()->clientCode;
|
||||
|
||||
$reset = $this->api()->withToken($token, 'POST', 'clients', [
|
||||
'action' => 'reset',
|
||||
'clientCode' => $code,
|
||||
]);
|
||||
$this->assertApiOk($reset);
|
||||
$this->assertTrue($reset['data']['reset'] ?? false);
|
||||
|
||||
$detail = $this->api()->withToken($token, 'GET', 'clients', null, [
|
||||
'clientCode' => $code,
|
||||
'detail' => '1',
|
||||
]);
|
||||
$this->assertApiOk($detail);
|
||||
$this->assertSame($code, $detail['data']['client']['clientCode'] ?? '');
|
||||
$this->assertSame([], $detail['data']['questionnaires'] ?? null);
|
||||
|
||||
$list = $this->api()->withToken($token, 'GET', 'clients');
|
||||
$this->assertApiOk($list);
|
||||
$row = null;
|
||||
foreach ($list['data']['clients'] as $client) {
|
||||
if (($client['clientCode'] ?? '') === $code) {
|
||||
$row = $client;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assertNotNull($row);
|
||||
$this->assertSame(0, (int)($row['hasResponseData'] ?? 1));
|
||||
}
|
||||
|
||||
public function testAdminDeletesClient(): void
|
||||
{
|
||||
$token = $this->api()->loginWebAndGetToken(
|
||||
|
||||
Reference in New Issue
Block a user