From f894b665ca10d00d488b18f043e6fd046f851469 Mon Sep 17 00:00:00 2001
From: Martynas Sudintas <martynas.sudintas@ongr.io>
Date: Fri, 6 Feb 2015 15:53:21 +0200
Subject: [PATCH] added more cardinality aggregation tests

---
 Aggregation/CardinalityAggregationTest.php | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Aggregation/CardinalityAggregationTest.php

diff --git a/Aggregation/CardinalityAggregationTest.php b/Aggregation/CardinalityAggregationTest.php
new file mode 100644
index 0000000..f0f4af2
--- /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();
+    }
+}
-- 
GitLab