From c3534b43835f7d4ec37c2911dc6ffa99f7cd6ff8 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 27 Aug 2021 19:45:18 -0400 Subject: [PATCH] Clean up code --- app/controllers/api/database.php | 9 --------- tests/e2e/Services/Database/DatabaseBase.php | 15 +++++---------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 2c134022d0..b97c1dee06 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -846,7 +846,6 @@ App::get('/v1/database/collections/:collectionId/attributes/:attributeId') // Select response model based on type and format $type = $attribute->getAttribute('type'); $format = $attribute->getAttribute('format'); - $formatOptions = $attribute->getAttribute('formatOptions'); $model = match($type) { Database::VAR_BOOLEAN => Response::MODEL_ATTRIBUTE_BOOLEAN, @@ -861,14 +860,6 @@ App::get('/v1/database/collections/:collectionId/attributes/:attributeId') default => Response::MODEL_ATTRIBUTE, }; - // Format response - // TODO@kodumbeats test if this is necessary with range filter - if ($model === Response::MODEL_ATTRIBUTE_INTEGER || $model === Response::MODEL_ATTRIBUTE_FLOAT) - { - $attribute->setAttribute('min', $formatOptions['min']); - $attribute->setAttribute('max', $formatOptions['max']); - } - $response->dynamic($attribute, $model); }); diff --git a/tests/e2e/Services/Database/DatabaseBase.php b/tests/e2e/Services/Database/DatabaseBase.php index b2d604ead1..380f6bd26a 100644 --- a/tests/e2e/Services/Database/DatabaseBase.php +++ b/tests/e2e/Services/Database/DatabaseBase.php @@ -100,11 +100,10 @@ trait DatabaseBase return $data; } - // /** - // * @depends testCreateAttributes - // */ - // public function testAttributeResponseModels(array $data): array - public function testAttributeResponseModels() + /** + * @depends testCreateAttributes + */ + public function testAttributeResponseModels(array $data): array { $collection= $this->client->call(Client::METHOD_POST, '/database/collections', array_merge([ 'content-type' => 'application/json', @@ -448,8 +447,6 @@ trait DatabaseBase 'x-appwrite-key' => $this->getProject()['apiKey'] ])); - // var_dump($collection); - $this->assertEquals(200, $collection['headers']['status-code']); $attributes = $collection['body']['attributes']; @@ -457,8 +454,6 @@ trait DatabaseBase $this->assertIsArray($attributes); $this->assertCount(7, $attributes); - var_dump($attributes); - $this->assertEquals($stringResponse['body']['key'], $attributes[0]['key']); $this->assertEquals($stringResponse['body']['type'], $attributes[0]['type']); $this->assertEquals($stringResponse['body']['status'], $attributes[0]['status']); @@ -516,7 +511,7 @@ trait DatabaseBase $this->assertEquals($booleanResponse['body']['array'], $attributes[6]['array']); $this->assertEquals($booleanResponse['body']['default'], $attributes[6]['default']); - // return $data; + return $data; } /**