tests(teams): after pagination tests
This commit is contained in:
parent
0b3bf50074
commit
69e5194dd6
|
@ -133,7 +133,7 @@ trait TeamsBase
|
|||
$this->assertGreaterThan(0, $response['body']['sum']);
|
||||
$this->assertIsInt($response['body']['sum']);
|
||||
$this->assertCount(2, $response['body']['teams']);
|
||||
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
@ -145,7 +145,7 @@ trait TeamsBase
|
|||
$this->assertGreaterThan(0, $response['body']['sum']);
|
||||
$this->assertIsInt($response['body']['sum']);
|
||||
$this->assertGreaterThan(2, $response['body']['teams']);
|
||||
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
@ -158,7 +158,7 @@ trait TeamsBase
|
|||
$this->assertIsInt($response['body']['sum']);
|
||||
$this->assertCount(1, $response['body']['teams']);
|
||||
$this->assertEquals('Manchester United', $response['body']['teams'][0]['name']);
|
||||
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
@ -172,6 +172,32 @@ trait TeamsBase
|
|||
$this->assertCount(1, $response['body']['teams']);
|
||||
$this->assertEquals('Manchester United', $response['body']['teams'][0]['name']);
|
||||
|
||||
$teams = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'limit' => 2,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $teams['headers']['status-code']);
|
||||
$this->assertGreaterThan(0, $teams['body']['sum']);
|
||||
$this->assertIsInt($teams['body']['sum']);
|
||||
$this->assertCount(2, $teams['body']['teams']);
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'limit' => 1,
|
||||
'after' => $teams['body']['teams'][0]['$id']
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertGreaterThan(0, $response['body']['sum']);
|
||||
$this->assertIsInt($response['body']['sum']);
|
||||
$this->assertCount(1, $response['body']['teams']);
|
||||
$this->assertEquals($teams['body']['teams'][1]['$id'], $response['body']['teams'][0]['$id']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
|
|
|
@ -138,6 +138,35 @@ trait TeamsBaseClient
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateTeamMembership
|
||||
*/
|
||||
public function testListTeamMemberships($data): void
|
||||
{
|
||||
$memberships = $this->client->call(Client::METHOD_GET, '/teams/'.$data['teamUid'].'/memberships', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $memberships['headers']['status-code']);
|
||||
$this->assertIsInt($memberships['body']['sum']);
|
||||
$this->assertNotEmpty($memberships['body']['memberships']);
|
||||
$this->assertCount(2, $memberships['body']['memberships']);
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/teams/'.$data['teamUid'].'/memberships', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'after' => $memberships['body']['memberships'][0]['$id']
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertIsInt($response['body']['sum']);
|
||||
$this->assertNotEmpty($response['body']['memberships']);
|
||||
$this->assertCount(1, $response['body']['memberships']);
|
||||
$this->assertEquals($memberships['body']['memberships'][1]['$id'], $response['body']['memberships'][0]['$id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateTeamMembership
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue