Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "input" from required rule fields, because it's not guaranteed to exist #17

Merged
merged 1 commit into from May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/QueryBuilderParser/QueryBuilderParser.php
Expand Up @@ -136,7 +136,7 @@ protected function createNestedQuery(Builder $querybuilder, stdClass $rule, $con
*/
protected function checkRuleCorrect(stdClass $rule)
{
if (!isset($rule->operator, $rule->id, $rule->field, $rule->input, $rule->type)) {
if (!isset($rule->operator, $rule->id, $rule->field, $rule->type)) {
return false;
}

Expand Down
7 changes: 1 addition & 6 deletions tests/CommonQueryBuilderTests.php
Expand Up @@ -10,15 +10,14 @@

class CommonQueryBuilderTests extends \PHPUnit_Framework_TestCase
{
protected $simpleQuery = '{"condition":"AND","rules":[{"id":"price","field":"price","type":"double","input":"text","operator":"less","value":"10.25"}]}';
protected $simpleQuery = '{"condition":"AND","rules":[{"id":"price","field":"price","type":"double","operator":"less","value":"10.25"}]}';
protected $json1 = '{
"condition":"AND",
"rules":[
{
"id":"price",
"field":"price",
"type":"double",
"input":"text",
"operator":"less",
"value":"10.25"
},
Expand All @@ -29,15 +28,13 @@ class CommonQueryBuilderTests extends \PHPUnit_Framework_TestCase
"id":"name",
"field":"name",
"type":"string",
"input":"text",
"operator":"begins_with",
"value":"Thommas"
},
{
"id":"name",
"field":"name",
"type":"string",
"input":"text",
"operator":"equal",
"value":"John Doe"
}
Expand Down Expand Up @@ -72,7 +69,6 @@ protected function makeJSONForInNotInTest($operator = 'in')
"id":"price",
"field":"price",
"type":"double",
"input":"text",
"operator":"less",
"value":"10.25"
},
Expand All @@ -82,7 +78,6 @@ protected function makeJSONForInNotInTest($operator = 'in')
"id":"category",
"field":"category",
"type":"integer",
"input":"select",
"operator":"'.$operator.'",
"value":[
"1", "2"
Expand Down