2020-01-17 03:06:28 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E\Services\Teams;
|
|
|
|
|
|
|
|
use Tests\E2E\Client;
|
2021-10-05 23:30:33 +13:00
|
|
|
use Utopia\Database\Database;
|
2022-07-13 04:44:58 +12:00
|
|
|
use Utopia\Database\DateTime;
|
2022-12-15 04:42:25 +13:00
|
|
|
use Utopia\Database\Helpers\ID;
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
trait TeamsBase
|
|
|
|
{
|
2022-05-24 02:54:50 +12:00
|
|
|
public function testCreateTeam(): array
|
2020-01-17 03:06:28 +13:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response1 = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-14 22:33:36 +12:00
|
|
|
'teamId' => ID::unique(),
|
2022-08-28 11:01:46 +12:00
|
|
|
'name' => 'Arsenal',
|
|
|
|
'roles' => ['player'],
|
2020-01-17 03:06:28 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(201, $response1['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response1['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Arsenal', $response1['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response1['body']['total']);
|
|
|
|
$this->assertIsInt($response1['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response1['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
2020-02-17 20:16:11 +13:00
|
|
|
$teamUid = $response1['body']['$id'];
|
2020-01-20 01:22:54 +13:00
|
|
|
$teamName = $response1['body']['name'];
|
2020-01-17 03:06:28 +13:00
|
|
|
|
2022-08-15 23:40:41 +12:00
|
|
|
$teamId = ID::unique();
|
2020-01-17 03:06:28 +13:00
|
|
|
$response2 = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-15 23:24:31 +12:00
|
|
|
'teamId' => $teamId,
|
2020-01-17 03:06:28 +13:00
|
|
|
'name' => 'Manchester United'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(201, $response2['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response2['body']['$id']);
|
2021-07-19 19:53:57 +12:00
|
|
|
$this->assertEquals($teamId, $response2['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Manchester United', $response2['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response2['body']['total']);
|
|
|
|
$this->assertIsInt($response2['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response2['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
$response3 = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-14 22:33:36 +12:00
|
|
|
'teamId' => ID::unique(),
|
2020-01-17 03:06:28 +13:00
|
|
|
'name' => 'Newcastle'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(201, $response3['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response3['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Newcastle', $response3['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response3['body']['total']);
|
|
|
|
$this->assertIsInt($response3['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response3['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
|
|
|
|
2020-01-20 01:22:54 +13:00
|
|
|
return ['teamUid' => $teamUid, 'teamName' => $teamName];
|
2020-01-17 03:06:28 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateTeam
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
public function testGetTeam($data): array
|
2020-01-17 03:06:28 +13:00
|
|
|
{
|
2020-10-15 10:11:12 +13:00
|
|
|
$id = $data['teamUid'] ?? '';
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams/' . $id, array_merge([
|
2020-01-17 03:06:28 +13:00
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()));
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Arsenal', $response['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
|
|
|
|
2020-10-28 08:48:38 +13:00
|
|
|
return [];
|
2020-01-17 03:06:28 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateTeam
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
public function testListTeams($data): array
|
2020-01-17 03:06:28 +13:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()));
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2020-07-09 01:02:01 +12:00
|
|
|
$this->assertGreaterThan(2, count($response['body']['teams']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'limit(2)' ],
|
2020-01-17 03:06:28 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-08-25 00:43:07 +12:00
|
|
|
$this->assertEquals(2, count($response['body']['teams']));
|
2021-08-10 01:04:14 +12:00
|
|
|
|
2020-01-17 03:06:28 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'offset(1)' ],
|
2020-01-17 03:06:28 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-08-25 00:43:07 +12:00
|
|
|
$this->assertGreaterThan(1, count($response['body']['teams']));
|
2021-08-10 01:04:14 +12:00
|
|
|
|
2022-08-24 23:55:43 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
|
|
|
'queries' => [ 'greaterThanEqual("total", 0)' ],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-08-25 00:43:07 +12:00
|
|
|
$this->assertGreaterThan(2, count($response['body']['teams']));
|
2022-08-24 23:55:43 +12:00
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
|
|
|
'queries' => [ 'equal("name", ["Arsenal", "Newcastle"])' ],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-08-25 00:43:07 +12:00
|
|
|
$this->assertEquals(2, count($response['body']['teams']));
|
2021-08-10 01:04:14 +12:00
|
|
|
|
2020-01-17 03:06:28 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
|
|
|
'search' => 'Manchester',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertCount(1, $response['body']['teams']);
|
|
|
|
$this->assertEquals('Manchester United', $response['body']['teams'][0]['name']);
|
2021-08-10 01:04:14 +12:00
|
|
|
|
2020-01-17 03:06:28 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
|
|
|
'search' => 'United',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertCount(1, $response['body']['teams']);
|
|
|
|
$this->assertEquals('Manchester United', $response['body']['teams'][0]['name']);
|
|
|
|
|
2021-09-21 20:22:13 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
|
|
|
'search' => $data['teamUid'],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2021-09-21 20:22:13 +12:00
|
|
|
$this->assertCount(1, $response['body']['teams']);
|
|
|
|
$this->assertEquals('Arsenal', $response['body']['teams'][0]['name']);
|
|
|
|
|
2021-08-10 01:04:14 +12:00
|
|
|
$teams = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'limit(2)' ],
|
2021-08-10 01:04:14 +12:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $teams['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $teams['body']['total']);
|
|
|
|
$this->assertIsInt($teams['body']['total']);
|
2021-08-10 01:04:14 +12:00
|
|
|
$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()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'limit(1)', 'cursorAfter("' . $teams['body']['teams'][0]['$id'] . '")' ],
|
2021-08-10 01:04:14 +12:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2021-08-10 01:04:14 +12:00
|
|
|
$this->assertCount(1, $response['body']['teams']);
|
|
|
|
$this->assertEquals($teams['body']['teams'][1]['$id'], $response['body']['teams'][0]['$id']);
|
|
|
|
|
2021-10-05 23:30:33 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'limit(1)', 'cursorBefore("' . $teams['body']['teams'][1]['$id'] . '")' ],
|
2021-10-05 23:30:33 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(0, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2021-10-05 23:30:33 +13:00
|
|
|
$this->assertCount(1, $response['body']['teams']);
|
|
|
|
$this->assertEquals($teams['body']['teams'][0]['$id'], $response['body']['teams'][0]['$id']);
|
|
|
|
|
2020-01-17 03:06:28 +13:00
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
2021-10-05 23:30:33 +13:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
|
|
], $this->getHeaders()), [
|
2022-08-24 21:22:13 +12:00
|
|
|
'queries' => [ 'cursorAfter("unknown")' ],
|
2021-10-05 23:30:33 +13:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
2020-01-17 03:06:28 +13:00
|
|
|
|
2020-10-28 08:48:38 +13:00
|
|
|
return [];
|
2020-01-17 03:06:28 +13:00
|
|
|
}
|
|
|
|
|
2022-05-24 02:54:50 +12:00
|
|
|
public function testUpdateTeam(): array
|
2020-01-17 03:06:28 +13:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-14 22:33:36 +12:00
|
|
|
'teamId' => ID::unique(),
|
2020-01-17 03:06:28 +13:00
|
|
|
'name' => 'Demo'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(201, $response['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Demo', $response['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
2022-05-24 02:54:50 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_PUT, '/teams/' . $response['body']['$id'], array_merge([
|
2020-01-17 03:06:28 +13:00
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-14 22:33:36 +12:00
|
|
|
'teamId' => ID::unique(),
|
2020-01-17 03:06:28 +13:00
|
|
|
'name' => 'Demo New'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
2020-01-17 03:06:28 +13:00
|
|
|
$this->assertEquals('Demo New', $response['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response['body']['$createdAt']));
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_PUT, '/teams/' . $response['body']['$id'], array_merge([
|
2020-01-17 03:06:28 +13:00
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(400, $response['headers']['status-code']);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2022-05-24 02:54:50 +12:00
|
|
|
public function testDeleteTeam(): array
|
2020-01-17 03:06:28 +13:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test for SUCCESS
|
|
|
|
*/
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-17 03:06:28 +13:00
|
|
|
], $this->getHeaders()), [
|
2022-08-14 22:33:36 +12:00
|
|
|
'teamId' => ID::unique(),
|
2020-01-17 03:06:28 +13:00
|
|
|
'name' => 'Demo'
|
|
|
|
]);
|
|
|
|
|
2020-02-17 20:16:11 +13:00
|
|
|
$teamUid = $response['body']['$id'];
|
2020-01-17 03:06:28 +13:00
|
|
|
|
|
|
|
$this->assertEquals(201, $response['headers']['status-code']);
|
2020-02-17 20:16:11 +13:00
|
|
|
$this->assertNotEmpty($response['body']['$id']);
|
2020-01-19 03:00:15 +13:00
|
|
|
$this->assertEquals('Demo', $response['body']['name']);
|
2022-02-27 22:57:09 +13:00
|
|
|
$this->assertGreaterThan(-1, $response['body']['total']);
|
|
|
|
$this->assertIsInt($response['body']['total']);
|
2022-12-15 21:51:27 +13:00
|
|
|
$this->assertEquals(true, self::$dateValidator->isValid($response['body']['$createdAt']));
|
2020-01-19 03:00:15 +13:00
|
|
|
|
2022-05-24 02:54:50 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamUid, array_merge([
|
2020-01-19 03:00:15 +13:00
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-19 03:00:15 +13:00
|
|
|
], $this->getHeaders()));
|
|
|
|
|
|
|
|
$this->assertEquals(204, $response['headers']['status-code']);
|
|
|
|
$this->assertEmpty($response['body']);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for FAILURE
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
$response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamUid, array_merge([
|
2020-01-19 03:00:15 +13:00
|
|
|
'content-type' => 'application/json',
|
2020-02-17 20:16:11 +13:00
|
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
2020-01-19 03:00:15 +13:00
|
|
|
], $this->getHeaders()));
|
|
|
|
|
|
|
|
$this->assertEquals(404, $response['headers']['status-code']);
|
|
|
|
|
|
|
|
return [];
|
|
|
|
}
|
2022-05-24 02:54:50 +12:00
|
|
|
}
|