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 --- .../lib/Elastica/Test/Facet/DateHistogramTest.php | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/DateHistogramTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/DateHistogramTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/DateHistogramTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/DateHistogramTest.php new file mode 100644 index 00000000..46dcdbf9 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/DateHistogramTest.php @@ -0,0 +1,59 @@ +assertInstanceOf('Elastica\Facet\Histogram', $facet); + $this->assertInstanceOf('Elastica\Facet\AbstractFacet', $facet); + unset($facet); + } + + public function testTest() + { + $client = $this->_getClient(); + $index = $client->getIndex('test'); + $index->create(array(), true); + $type = $index->getType('helloworld'); + + $mapping = new Mapping($type, array( + 'name' => array('type' => 'string', 'store' => 'no'), + 'dtmPosted' => array('type' => 'date', 'store' => 'no', 'format' => 'yyyy-MM-dd HH:mm:ss') + )); + $type->setMapping($mapping); + + $doc = new Document(1, array('name' => 'nicolas ruflin', 'dtmPosted' => "2011-06-23 21:53:00")); + $type->addDocument($doc); + $doc = new Document(2, array('name' => 'raul martinez jr', 'dtmPosted' => "2011-06-23 09:53:00")); + $type->addDocument($doc); + $doc = new Document(3, array('name' => 'rachelle clemente', 'dtmPosted' => "2011-07-08 08:53:00")); + $type->addDocument($doc); + $doc = new Document(4, array('name' => 'elastica search', 'dtmPosted' => "2011-07-08 01:53:00")); + $type->addDocument($doc); + + $facet = new DateHistogram('dateHist1'); + $facet->setInterval("day"); + $facet->setField("dtmPosted"); + + $query = new Query(); + $query->addFacet($facet); + $query->setQuery(new MatchAll()); + $index->refresh(); + + $response = $type->search($query); + $facets = $response->getFacets(); + + $this->assertEquals(4, $response->getTotalHits()); + $this->assertEquals(2, count($facets['dateHist1']['entries'])); + } +} -- cgit v1.2.3-54-g00ecf