Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Database/Validator/Queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function isValid($value): bool
*/
public function isArray(): bool
{
return true;
return is_array($value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used, but it still shouldn't be changed so that it's consistent with others.

}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/Validator/QueriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public function testInvalidValue(): void
$this->assertEquals(false, $validator->isValid(['limit(-1)']));
}

public function testInvalidApiCall(): void
{
$validator = new Queries();
$queryParams = ['queries' => 100];
$isValid = $validator->isValid($queryParams['queries']);
$this->assertFalse($isValid);
$this->assertStringContainsString('Queries must be an array', $validator->getDescription());
}

/**
* @throws Exception
*/
Expand Down