add new tests

This commit is contained in:
Matej Bačo
2025-08-26 15:29:11 +02:00
parent 43f75d082e
commit a413235f8d
4 changed files with 32 additions and 8 deletions
@@ -49,7 +49,7 @@ class Base extends Queries
if (!isset($allowedAttributesLookup[$key])) {
continue;
}
$attributeDocument = new Document([
'key' => $key,
'type' => $attribute['type'],
@@ -59,7 +59,7 @@ class Base extends Queries
$attributes[] = $attributeDocument;
$allAttributes[] = $attributeDocument;
}
$internalAttributes = [
new Document([
'key' => '$id',
@@ -82,8 +82,8 @@ class Base extends Queries
'array' => false,
])
];
foreach($internalAttributes as $attribute) {
foreach ($internalAttributes as $attribute) {
$attributes[] = $attribute;
$allAttributes[] = $attribute;
}
@@ -95,14 +95,14 @@ class Base extends Queries
new Filter($attributes, APP_DATABASE_QUERY_MAX_VALUES),
new Order($attributes),
];
if($this->isSelectQueryAllowed()) {
if ($this->isSelectQueryAllowed()) {
$validators[] = new Select($allAttributes);
}
parent::__construct($validators);
}
public function isSelectQueryAllowed(): bool
{
return true;
@@ -22,7 +22,7 @@ class Deployments extends Base
{
parent::__construct('deployments', self::ALLOWED_ATTRIBUTES);
}
public function isSelectQueryAllowed(): bool
{
return true;
@@ -721,6 +721,18 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals($deployments['headers']['status-code'], 200);
$this->assertCount(1, $deployments['body']['deployments']);
$deployments = $this->listDeployments($functionId, [
'queries' => [
Query::select(['status'])->toString(),
],
]);
$this->assertEquals($deployments['headers']['status-code'], 200);
$this->assertArrayHasKey('status', $deployments['body']['deployments'][0]);
$this->assertArrayHasKey('status', $deployments['body']['deployments'][1]);
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]);
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][1]);
$deployments = $this->listDeployments($functionId, [
'queries' => [
Query::offset(1)->toString(),
@@ -1052,6 +1052,18 @@ class SitesCustomServerTest extends Scope
$this->assertEquals($deployments['headers']['status-code'], 200);
$this->assertCount(1, $deployments['body']['deployments']);
$deployments = $this->listDeployments($siteId, [
'queries' => [
Query::select(['status'])->toString(),
],
]);
$this->assertEquals($deployments['headers']['status-code'], 200);
$this->assertArrayHasKey('status', $deployments['body']['deployments'][0]);
$this->assertArrayHasKey('status', $deployments['body']['deployments'][1]);
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]);
$this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][1]);
$deployments = $this->listDeployments($siteId, [
'queries' => [
Query::offset(1)->toString(),