Added storage test
This commit is contained in:
parent
82209da6c7
commit
7fddb31eee
40
tests/e2e/ProjectStorageTest.php
Normal file
40
tests/e2e/ProjectStorageTest.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\E2E;
|
||||
|
||||
use CURLFile;
|
||||
use Tests\E2E\Client;
|
||||
|
||||
class ProjectStorafeTest extends BaseProjects
|
||||
{
|
||||
public function testRegisterSuccess(): array
|
||||
{
|
||||
return $this->initProject(['files.read', 'files.write']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRegisterSuccess
|
||||
*/
|
||||
public function testFileCreateSuccess(array $data): array
|
||||
{
|
||||
$file = $this->client->call(Client::METHOD_POST, '/storage/files', [
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $data['projectUid'],
|
||||
'x-appwrite-key' => $data['projectAPIKeySecret'],
|
||||
], [
|
||||
'files' => new CURLFile(realpath(__DIR__ . '/../resources/logo.png'), 'image/png', 'logo.png'),
|
||||
'read' => ['*'],
|
||||
'write' => ['*'],
|
||||
'folderId' => 'xyz',
|
||||
]);
|
||||
|
||||
$this->assertNotEmpty($file['body'][0]['$uid']);
|
||||
$this->assertEquals('files', $file['body'][0]['$collection']);
|
||||
$this->assertIsInt($file['body'][0]['dateCreated']);
|
||||
$this->assertEquals('logo.png', $file['body'][0]['name']);
|
||||
$this->assertEquals('image/png', $file['body'][0]['mimeType']);
|
||||
$this->assertEquals(47218, $file['body'][0]['sizeOriginal']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
BIN
tests/resources/logo.png
Normal file
BIN
tests/resources/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
Loading…
Reference in a new issue