Skip to content

Commit

Permalink
query: fixed filter in with string values
Browse files Browse the repository at this point in the history
  • Loading branch information
bauer01 committed Jan 12, 2016
1 parent 9f0098e commit 737d8f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private function _formatFilter(array $filter, $or = false)

$modifier = "IN";
if (array_filter($value, 'is_string')) {
$value = "('" . implode("','", $value) . ")";
$value = "('" . implode("','", $value) . "')";
} else {
$value = "(" . implode(",", $value) . ")";
}
Expand Down
9 changes: 9 additions & 0 deletions tests/cases/Query.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class QueryTest extends Tester\TestCase
);
}

public function testSetFilterInString()
{
$this->query->setFilter(["in" => [Filter::EQUAL => ["1", "2"]]]);
Assert::same(
"objednavka-prijata/(in IN ('1','2')).json?code-as-id=true",
rawurldecode($this->query->getRaw())
);
}

public function testSetFilterEqual()
{
$this->query->setFilter(["equal" => [Filter::EQUAL=> 1]]);
Expand Down

0 comments on commit 737d8f7

Please sign in to comment.