mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
31 lines
939 B
PHP
31 lines
939 B
PHP
<?php
|
|
|
|
namespace Tests\E2E\Services\Databases\DocumentsDB;
|
|
|
|
use Tests\E2E\Client;
|
|
use Utopia\Database\Helpers\ID;
|
|
|
|
trait DatabasesBase
|
|
{
|
|
public function testCreateDatabase(): array
|
|
{
|
|
/**
|
|
* Test for SUCCESS
|
|
*/
|
|
$database = $this->client->call(Client::METHOD_POST, '/documentsdb', [
|
|
'content-type' => 'application/json',
|
|
'x-appwrite-project' => $this->getProject()['$id'],
|
|
'x-appwrite-key' => $this->getProject()['apiKey']
|
|
], [
|
|
'databaseId' => ID::unique(),
|
|
'name' => 'Test Database'
|
|
]);
|
|
|
|
$this->assertNotEmpty($database['body']['$id']);
|
|
$this->assertEquals(201, $database['headers']['status-code']);
|
|
$this->assertEquals('Test Database', $database['body']['name']);
|
|
$this->assertEquals('legacy', $database['body']['type']);
|
|
|
|
return ['databaseId' => $database['body']['$id']];
|
|
}
|
|
}
|