Skip to content
Snippets Groups Projects
Unverified Commit ffb35940 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas Committed by GitHub
Browse files

fix bool query when the body is empty (#263)

parent 4e7e2352
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,10 @@ class BoolQuery implements BuilderInterface
$output = $this->processArray($output);
if (empty($output)) {
$output = new \stdClass();
}
return [$this->getType() => $output];
}
......
......@@ -69,6 +69,16 @@ class BoolQueryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $bool->toArray());
}
/**
* Tests bool query with empty body if it forms \stdObject
*/
public function testEmptyBoolQuery()
{
$bool = new BoolQuery();
$this->assertEquals(['bool' => new \stdClass()], $bool->toArray());
}
/**
* Tests bool query in filter context.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment