1
0
Fork 0
mirror of synced 2024-06-16 17:54:53 +12:00

Added tests

This commit is contained in:
Eldad Fux 2020-06-09 22:54:15 +03:00
parent 13bd66e502
commit 11b935756b

View file

@ -411,4 +411,95 @@ trait AvatarsBase
return [];
}
public function testGetInitials()
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('image/png; charset=UTF-8', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'width' => 200,
'height' => 200,
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('image/png; charset=UTF-8', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => 'W W',
'width' => 200,
'height' => 200,
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('image/png; charset=UTF-8', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => 'W W',
'width' => 200,
'height' => 200,
'color' => 'ffffff',
'background' => '000000',
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('image/png; charset=UTF-8', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => 'W W',
'width' => 200000,
'height' => 200,
'color' => 'ffffff',
'background' => '000000',
]);
$this->assertEquals(400, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => 'W W',
'width' => 200,
'height' => 200,
'color' => 'white',
'background' => '000000',
]);
$this->assertEquals(400, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => 'W W',
'width' => 200,
'height' => 200,
'color' => 'ffffff',
'background' => 'black',
]);
$this->assertEquals(400, $response['headers']['status-code']);
}
}