Test for creating indexes
This commit is contained in:
parent
1d2d869fa8
commit
80f41edf36
|
@ -89,11 +89,34 @@ trait DatabaseBase
|
|||
return $data;
|
||||
}
|
||||
|
||||
// TODO@kodumbeats create and test indexes
|
||||
|
||||
/**
|
||||
* @depends testCreateAttributes
|
||||
*/
|
||||
public function testCreateIndexes(array $data): array
|
||||
{
|
||||
$titleIndex = $this->client->call(Client::METHOD_POST, '/database/collections/' . $data['moviesId'] . '/indexes', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'id' => 'titleIndex',
|
||||
'type' => 'fulltext',
|
||||
'attributes' => ['title'],
|
||||
]);
|
||||
|
||||
$this->assertEquals($titleIndex['headers']['status-code'], 201);
|
||||
$this->assertEquals($titleIndex['body']['$collection'], $data['moviesId']);
|
||||
$this->assertEquals($titleIndex['body']['$id'], 'titleIndex');
|
||||
$this->assertEquals($titleIndex['body']['type'], 'fulltext');
|
||||
$this->assertCount(1, $titleIndex['body']['attributes']);
|
||||
$this->assertEquals($titleIndex['body']['attributes'][0], 'title');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateIndexes
|
||||
*/
|
||||
public function testCreateDocument(array $data):array
|
||||
{
|
||||
$document1 = $this->client->call(Client::METHOD_POST, '/database/collections/' . $data['moviesId'] . '/documents', array_merge([
|
||||
|
|
Loading…
Reference in a new issue