diff --git a/Aggregation/CardinalityAggregationTest.php b/Aggregation/CardinalityAggregationTest.php index 68a03056113dabb13d2191b14234b79eb05700c4..3a03e480761f474471a0cbc6701ddca7fee3b832 100644 --- a/Aggregation/CardinalityAggregationTest.php +++ b/Aggregation/CardinalityAggregationTest.php @@ -65,6 +65,4 @@ class CardinalityAggregationTest extends \PHPUnit_Framework_TestCase $aggregation = new CardinalityAggregation('bar'); $aggregation->getArray(); } - - } diff --git a/Aggregation/ChildrenAggregationTest.php b/Aggregation/ChildrenAggregationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fc264d69bb26d8c823edcf51237064e0e8ee2bce --- /dev/null +++ b/Aggregation/ChildrenAggregationTest.php @@ -0,0 +1,31 @@ +<?php + +/* + * This file is part of the ONGR package. + * + * (c) NFQ Technologies UAB <info@nfq.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation; + +use ONGR\ElasticsearchBundle\DSL\Aggregation\ChildrenAggregation; + +/** + * Unit test for children aggregation. + */ +class ChildrenAggregationTest extends \PHPUnit_Framework_TestCase +{ + /** + * Tests if ChildrenAggregation#getArray throws exception when expected. + * + * @expectedException \LogicException + */ + public function testGetArrayException() + { + $aggregation = new ChildrenAggregation('foo'); + $aggregation->getArray(); + } +} diff --git a/Aggregation/FilterAggregationTest.php b/Aggregation/FilterAggregationTest.php index 0b45a48ae0951482ddb2e4317a22cb8d4e0040cf..520c18bb767def7cbbc7794d8678e3b65244f04d 100644 --- a/Aggregation/FilterAggregationTest.php +++ b/Aggregation/FilterAggregationTest.php @@ -12,6 +12,8 @@ namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation; use ONGR\ElasticsearchBundle\DSL\Aggregation\FilterAggregation; +use ONGR\ElasticsearchBundle\DSL\Filter\AndFilter; +use ONGR\ElasticsearchBundle\DSL\Filter\MissingFilter; class FilterAggregationTest extends \PHPUnit_Framework_TestCase { @@ -130,4 +132,15 @@ class FilterAggregationTest extends \PHPUnit_Framework_TestCase $aggregation = new FilterAggregation('test_agg'); $aggregation->toArray(); } + + /** + * Test for toArray() with setting a filter. + */ + public function testToArrayWithFilter() + { + $aggregation = new FilterAggregation('test_agg'); + + $aggregation->setFilter(new MissingFilter('test')); + $aggregation->toArray(); + } } diff --git a/Suggester/PhraseTest.php b/Suggester/PhraseTest.php index 623f7a09abdd9dfc29d423c7a3f1e82b625b1a89..bef3d3d75be99d06a20ea451918af875034376c7 100644 --- a/Suggester/PhraseTest.php +++ b/Suggester/PhraseTest.php @@ -109,7 +109,6 @@ class PhraseTest extends \PHPUnit_Framework_TestCase { $this->setStub(new Phrase('foo', 'bar')); - return 'ONGR\ElasticsearchBundle\DSL\Suggester\Phrase'; } @@ -130,4 +129,4 @@ class PhraseTest extends \PHPUnit_Framework_TestCase ['size'], ]; } -} \ No newline at end of file +}