client->call(Client::METHOD_GET, '/users/usage', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), [ 'range' => '32h', ]); $this->assertEquals($response['headers']['status-code'], 400); // // $response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([ // 'content-type' => 'application/json', // 'x-appwrite-project' => $this->getProject()['$id'] // ], $this->getHeaders()), [ // 'range' => '24h', // 'provider' => 'some-random-provider' // ]); // // $this->assertEquals($response['headers']['status-code'], 400); // /** // * Test for SUCCESS // */ // $response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([ // 'content-type' => 'application/json', // 'x-appwrite-project' => $this->getProject()['$id'] // ], $this->getHeaders()), [ // 'range' => '24h', // ]); // // $this->assertEquals($response['headers']['status-code'], 200); // $this->assertEquals(count($response['body']), 2); // $this->assertEquals($response['body']['range'], '24h'); // $this->assertIsArray($response['body']['usersCount']); // $this->assertIsArray($response['body']['sessionsCount']); $response = $this->client->call(Client::METHOD_GET, '/users/usage', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), [ 'range' => '24h' ]); $this->assertEquals($response['headers']['status-code'], 200); $this->assertEquals(count($response['body']), 2); $this->assertEquals($response['body']['range'], '24h'); $this->assertIsArray($response['body']['usersCount']); $this->assertIsArray($response['body']['sessionsCount']); } }