diff --git a/Aggregation/CardinalityAggregationTest.php b/Aggregation/CardinalityAggregationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f0f4af24e005d1ddfc7c1256ce66bbb0abd51e7c --- /dev/null +++ b/Aggregation/CardinalityAggregationTest.php @@ -0,0 +1,32 @@ +<?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\CardinalityAggregation; + +/** + * Unit test for cardinality aggregation. + */ +class CardinalityAggregationTest extends \PHPUnit_Framework_TestCase +{ + /** + * Tests if CardinalityAggregation#getArray throws exception when expected. + * + * @expectedException \LogicException + * @expectedExceptionMessage Cardinality aggregation must have field or script set. + */ + public function testGetArrayException() + { + $aggregation = new CardinalityAggregation('bar'); + $aggregation->getArray(); + } +}