From aec11bc6302e105f6a9acd1caa3faca6b413531a Mon Sep 17 00:00:00 2001 From: Mantas <marc.mantas@gmail.com> Date: Mon, 27 Jun 2016 15:44:43 +0300 Subject: [PATCH] added significant terms aggregation test --- .../SignificantTermsAggregationTest.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/Aggregation/SignificantTermsAggregationTest.php diff --git a/tests/Aggregation/SignificantTermsAggregationTest.php b/tests/Aggregation/SignificantTermsAggregationTest.php new file mode 100644 index 0000000..1406d41 --- /dev/null +++ b/tests/Aggregation/SignificantTermsAggregationTest.php @@ -0,0 +1,45 @@ +<?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\ElasticsearchDSL\Tests\Aggregation; + +use ONGR\ElasticsearchDSL\Aggregation\SignificantTermsAggregation; + +/** + * Unit test for children aggregation. + */ +class SignificantTermsAggregationTest extends \PHPUnit_Framework_TestCase +{ + /** + * Tests getType method. + */ + public function testSignificantTermsAggregationGetType() + { + $aggregation = new SignificantTermsAggregation('foo'); + $result = $aggregation->getType(); + $this->assertEquals('significant_terms', $result); + } + + /** + * Tests getArray method. + */ + public function testSignificantTermsAggregationGetArray() + { + $mock = $this->getMockBuilder('ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $aggregation = new SignificantTermsAggregation('foo', 'title'); + $aggregation->addAggregation($mock); + $result = $aggregation->getArray(); + $expected = ['field' => 'title']; + $this->assertEquals($expected, $result); + } +} -- GitLab