From 1a365e77dfb8825136626202b1df462731b42060 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 16 Aug 2015 08:22:05 +0200 Subject: Update to MediaWiki 1.25.2 --- .../Elastica/Test/Aggregation/CardinalityTest.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/CardinalityTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/CardinalityTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/CardinalityTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/CardinalityTest.php new file mode 100644 index 00000000..d2f4d2be --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/CardinalityTest.php @@ -0,0 +1,38 @@ +_index = $this->_createIndex("cardinality"); + $docs = array( + new Document("1", array("color" => "blue")), + new Document("2", array("color" => "blue")), + new Document("3", array("color" => "red")), + new Document("4", array("color" => "green")), + ); + $this->_index->getType("test")->addDocuments($docs); + $this->_index->refresh(); + } + + public function testCardinalityAggregation() + { + $agg = new Cardinality("cardinality"); + $agg->setField("color"); + + $query = new Query(); + $query->addAggregation($agg); + $results = $this->_index->search($query)->getAggregation("cardinality"); + + $this->assertEquals(3, $results['value']); + } +} + -- cgit v1.2.2