2019-10-22 01:37:34 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E;
|
|
|
|
|
|
|
|
use Tests\E2E\Client;
|
|
|
|
|
|
|
|
class ProjectAvatarsTest extends BaseProjects
|
|
|
|
{
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testRegisterSuccess(): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
return $this->initProject([]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsCCReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/credit-cards/visa', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
]);
|
|
|
|
|
2019-11-17 09:16:19 +13:00
|
|
|
var_dump('------------');
|
2019-11-17 09:34:01 +13:00
|
|
|
echo $logo['body'];
|
2019-11-17 09:16:19 +13:00
|
|
|
var_dump('------------');
|
2019-11-17 02:34:31 +13:00
|
|
|
|
2019-10-22 01:37:34 +13:00
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-10 18:28:14 +13:00
|
|
|
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('ef7512678fc617a708298a535dac143b', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/credit-cards/visa', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 200,
|
|
|
|
'height' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('022ca094acd9eb6c59a5e0ee5b6d6f14', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/credit-cards/visa', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 300,
|
|
|
|
'height' => 300,
|
|
|
|
'quality' => 30,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('2b4052955b6515d667990b22cbd4dc82', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsBrowserReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/browsers/ch', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('0c9ed000128635206d72e55b287a5be0', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/browsers/ch', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 200,
|
|
|
|
'height' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('2a9da62aa876303dab6d8e00d2f8789c', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/browsers/ch', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 300,
|
|
|
|
'height' => 300,
|
|
|
|
'quality' => 30,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('111cbe4bef171fb47ac1f597274279ed', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsFlagReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/flags/us', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('39da0f4b444b1a41e9fe850589fb082f', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/flags/us', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 200,
|
|
|
|
'height' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('37fa54e9f4b0c868365e7f0721aae1d6', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/flags/us', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'width' => 300,
|
|
|
|
'height' => 300,
|
|
|
|
'quality' => 30,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('e3d32d455826451e1d88f58417716502', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsRemoteImageReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/image', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'url' => 'https://appwrite.io/images/apple.png',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:16:05 +13:00
|
|
|
$this->assertEquals('8718564af44bf2672b184ef1e0baee81', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/image', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'url' => 'https://appwrite.io/images/apple.png',
|
|
|
|
'width' => 200,
|
|
|
|
'height' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:16:05 +13:00
|
|
|
$this->assertEquals('53ed3af9150a94edbfed25cd65283bcc', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/image', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'url' => 'https://appwrite.io/images/apple.png',
|
|
|
|
'width' => 300,
|
|
|
|
'height' => 300,
|
|
|
|
'quality' => 30,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:16:05 +13:00
|
|
|
$this->assertEquals('2dac180f0b3f8dc9de7e65c978eac9db', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsFaviconReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/favicon', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'url' => 'https://appwrite.io/',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('5f22187ae9b19c9d92a28b3ce1f74777', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testRegisterSuccess
|
|
|
|
*/
|
2019-11-04 08:05:26 +13:00
|
|
|
public function testAvatarsQRReadSuccess(array $data): array
|
2019-10-22 01:37:34 +13:00
|
|
|
{
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'text' => 'url:https://appwrite.io/',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('c5c7224f33e68e11022529f846086217', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'text' => 'url:https://appwrite.io/',
|
|
|
|
'size' => 200,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('385dbbd81bab7a4b9e4d621a0c34fa71', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'text' => 'url:https://appwrite.io/',
|
|
|
|
'size' => 200,
|
|
|
|
'margin' => 10,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('bc2a09d6a34d9a3e9ac81c9a0a43a7f3', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
$logo = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
|
|
|
|
'x-appwrite-project' => $data['projectUid'],
|
|
|
|
], [
|
|
|
|
'text' => 'url:https://appwrite.io/',
|
|
|
|
'size' => 200,
|
|
|
|
'margin' => 10,
|
|
|
|
'download' => 1,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $logo['headers']['status-code']);
|
|
|
|
$this->assertEquals('attachment; filename="qr.png"', $logo['headers']['content-disposition']);
|
|
|
|
$this->assertEquals('image/png; charset=UTF-8', $logo['headers']['content-type']);
|
2019-11-17 02:05:02 +13:00
|
|
|
$this->assertEquals('bc2a09d6a34d9a3e9ac81c9a0a43a7f3', md5($logo['body']));
|
2019-10-22 01:37:34 +13:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|