mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix merge
This commit is contained in:
+2
-2
@@ -12,8 +12,8 @@
|
||||
],
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit",
|
||||
"lint": "vendor/bin/pint --test",
|
||||
"format": "vendor/bin/pint",
|
||||
"lint": "vendor/bin/pint --test --config pint.json",
|
||||
"format": "vendor/bin/pint --config pint.json",
|
||||
"bench": "vendor/bin/phpbench run --report=benchmark",
|
||||
"check": "./vendor/bin/phpstan analyse -c phpstan.neon"
|
||||
},
|
||||
|
||||
@@ -6,3 +6,4 @@ parameters:
|
||||
- vendor/swoole/ide-helper
|
||||
excludePaths:
|
||||
- tests/resources
|
||||
- app/sdks
|
||||
@@ -1437,8 +1437,8 @@ trait DatabasesBase
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAttributes
|
||||
*/
|
||||
* @depends testCreateAttributes
|
||||
*/
|
||||
public function testGetIndexByKeyWithLengths(array $data): void
|
||||
{
|
||||
$databaseId = $data['databaseId'];
|
||||
@@ -1508,8 +1508,8 @@ trait DatabasesBase
|
||||
$this->assertEquals(400, $create['headers']['status-code']);
|
||||
}
|
||||
/**
|
||||
* @depends testCreateIndexes
|
||||
*/
|
||||
* @depends testCreateIndexes
|
||||
*/
|
||||
public function testListIndexes(array $data): void
|
||||
{
|
||||
$databaseId = $data['databaseId'];
|
||||
@@ -1979,39 +1979,33 @@ trait DatabasesBase
|
||||
]);
|
||||
$this->assertEquals(2, $documents['body']['total']);
|
||||
|
||||
if ($this->getSide() === 'client') {
|
||||
// Skipped on server side: Creating a document with no permissions results in an empty permissions array, whereas on client side it assigns permissions to the current user
|
||||
// test without passing permissions
|
||||
$document = $this->client->call(Client::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'data' => [
|
||||
'title' => 'Thor: Ragnarok',
|
||||
'releaseYear' => 2000
|
||||
]
|
||||
]);
|
||||
|
||||
// test without passing permissions
|
||||
$document = $this->client->call(Client::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'data' => [
|
||||
'title' => 'Thor: Ragnarok',
|
||||
'releaseYear' => 2000
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(200, $document['headers']['status-code']);
|
||||
$this->assertEquals('Thor: Ragnarok', $document['body']['title']);
|
||||
|
||||
$this->assertEquals(200, $document['headers']['status-code']);
|
||||
$this->assertEquals('Thor: Ragnarok', $document['body']['title']);
|
||||
$this->assertCount(3, $document['body']['$permissions']);
|
||||
$permissionsCreated = $document['body']['$permissions'];
|
||||
// checking the default created permission
|
||||
$defaultPermission = [
|
||||
Permission::read(Role::user($this->getUser()['$id'])),
|
||||
Permission::update(Role::user($this->getUser()['$id'])),
|
||||
Permission::delete(Role::user($this->getUser()['$id']))
|
||||
];
|
||||
// ignoring the order of the permission and checking the permissions
|
||||
$this->assertEqualsCanonicalizing($defaultPermission, $permissionsCreated);
|
||||
$document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]));
|
||||
|
||||
$document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id']
|
||||
], $this->getHeaders()));
|
||||
$this->assertEquals(200, $document['headers']['status-code']);
|
||||
|
||||
$this->assertEquals(200, $document['headers']['status-code']);
|
||||
$deleteResponse = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]));
|
||||
|
||||
$this->assertEquals(204, $deleteResponse['headers']['status-code']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user