Skip to content
Snippets Groups Projects
Commit 86a81167 authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Test constructor arguments to FilterAggregation.

parent 4dd251a1
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
use ONGR\ElasticsearchDSL\Aggregation\FilterAggregation;
use ONGR\ElasticsearchDSL\Filter\AndFilter;
use ONGR\ElasticsearchDSL\BuilderInterface;
use ONGR\ElasticsearchDSL\Filter\MissingFilter;
class FilterAggregationTest extends \PHPUnit_Framework_TestCase
......@@ -143,4 +143,22 @@ class FilterAggregationTest extends \PHPUnit_Framework_TestCase
$aggregation->setFilter(new MissingFilter('test'));
$aggregation->toArray();
}
/**
* Tests if filter can be passed to constructor.
*/
public function testConstructorFilter()
{
/** @var BuilderInterface|\PHPUnit_Framework_MockObject_MockObject $builderInterface */
$builderInterface = $this->getMockForAbstractClass('ONGR\ElasticsearchDSL\BuilderInterface');
$aggregation = new FilterAggregation('test', $builderInterface);
$this->assertSame(
[
'agg_test' => [
'filter' => [null => null],
],
],
$aggregation->toArray()
);
}
}
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