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": {
|
"scripts": {
|
||||||
"test": "vendor/bin/phpunit",
|
"test": "vendor/bin/phpunit",
|
||||||
"lint": "vendor/bin/pint --test",
|
"lint": "vendor/bin/pint --test --config pint.json",
|
||||||
"format": "vendor/bin/pint",
|
"format": "vendor/bin/pint --config pint.json",
|
||||||
"bench": "vendor/bin/phpbench run --report=benchmark",
|
"bench": "vendor/bin/phpbench run --report=benchmark",
|
||||||
"check": "./vendor/bin/phpstan analyse -c phpstan.neon"
|
"check": "./vendor/bin/phpstan analyse -c phpstan.neon"
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-1
@@ -5,4 +5,5 @@ parameters:
|
|||||||
scanDirectories:
|
scanDirectories:
|
||||||
- vendor/swoole/ide-helper
|
- vendor/swoole/ide-helper
|
||||||
excludePaths:
|
excludePaths:
|
||||||
- tests/resources
|
- tests/resources
|
||||||
|
- app/sdks
|
||||||
@@ -1437,8 +1437,8 @@ trait DatabasesBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depends testCreateAttributes
|
* @depends testCreateAttributes
|
||||||
*/
|
*/
|
||||||
public function testGetIndexByKeyWithLengths(array $data): void
|
public function testGetIndexByKeyWithLengths(array $data): void
|
||||||
{
|
{
|
||||||
$databaseId = $data['databaseId'];
|
$databaseId = $data['databaseId'];
|
||||||
@@ -1508,8 +1508,8 @@ trait DatabasesBase
|
|||||||
$this->assertEquals(400, $create['headers']['status-code']);
|
$this->assertEquals(400, $create['headers']['status-code']);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @depends testCreateIndexes
|
* @depends testCreateIndexes
|
||||||
*/
|
*/
|
||||||
public function testListIndexes(array $data): void
|
public function testListIndexes(array $data): void
|
||||||
{
|
{
|
||||||
$databaseId = $data['databaseId'];
|
$databaseId = $data['databaseId'];
|
||||||
@@ -1979,39 +1979,33 @@ trait DatabasesBase
|
|||||||
]);
|
]);
|
||||||
$this->assertEquals(2, $documents['body']['total']);
|
$this->assertEquals(2, $documents['body']['total']);
|
||||||
|
|
||||||
if ($this->getSide() === 'client') {
|
// test without passing permissions
|
||||||
// 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
|
$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
|
$this->assertEquals(200, $document['headers']['status-code']);
|
||||||
$document = $this->client->call(Client::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
$this->assertEquals('Thor: Ragnarok', $document['body']['title']);
|
||||||
'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']);
|
$document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/' . $documentId, array_merge([
|
||||||
$this->assertEquals('Thor: Ragnarok', $document['body']['title']);
|
'content-type' => 'application/json',
|
||||||
$this->assertCount(3, $document['body']['$permissions']);
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
$permissionsCreated = $document['body']['$permissions'];
|
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||||
// 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([
|
$this->assertEquals(200, $document['headers']['status-code']);
|
||||||
'content-type' => 'application/json',
|
|
||||||
'x-appwrite-project' => $this->getProject()['$id']
|
|
||||||
], $this->getHeaders()));
|
|
||||||
|
|
||||||
$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']);
|
$this->assertEquals(204, $deleteResponse['headers']['status-code']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user