From 276b1de2b018d4ea9cb4e512ddfc556ac796f40c Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 26 Mar 2023 16:27:07 +0300 Subject: [PATCH] Disable 2 way for ManyToOne relation test --- .../e2e/Services/Databases/DatabasesBase.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index eb26bc883a..7b3a2fb892 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -3468,7 +3468,6 @@ trait DatabasesBase 'key' => 'artist', 'twoWayKey' => 'albums', ]); - $this->assertEquals(202, $response['headers']['status-code']); $this->assertEquals('artist', $response['body']['key']); $this->assertEquals('relationship', $response['body']['type']); @@ -3535,6 +3534,27 @@ trait DatabasesBase $this->assertEquals('Album 1', $artist['body']['albums'][0]['name']); $this->assertEquals($permissions, $artist['body']['albums'][0]['$permissions']); + // Update disable 2 way + $relation = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $albums['body']['$id'] . '/attributes/artist/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'twoWay' => false, + ]); + + + $this->assertEquals(202, $response['headers']['status-code']); + $artist = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $artists['body']['$id'] . '/documents/' . $album['body']['artist']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $artist['headers']['status-code']); + $this->assertEquals('Artist 1', $artist['body']['name']); + $this->assertEquals($permissions, $artist['body']['$permissions']); + $this->assertArrayNotHasKey("albums", $artist['body']); + return [ 'databaseId' => $databaseId, 'albumsCollection' => $albums['body']['$id'],