diff options
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php index d9f37a20..58eb02c2 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/TermsTest.php @@ -1,39 +1,41 @@ <?php - namespace Elastica\Test\Aggregation; - use Elastica\Aggregation\Terms; use Elastica\Document; use Elastica\Query; class TermsTest extends BaseAggregationTest { - protected function setUp() + protected function _getIndexForTest() { - parent::setUp(); - $this->_index = $this->_createIndex("terms"); - $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(); + $index = $this->_createIndex(); + + $index->getType('test')->addDocuments(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')), + )); + + $index->refresh(); + + return $index; } + /** + * @group functional + */ public function testTermsAggregation() { - $agg = new Terms("terms"); - $agg->setField("color"); + $agg = new Terms('terms'); + $agg->setField('color'); $query = new Query(); $query->addAggregation($agg); - $results = $this->_index->search($query)->getAggregation("terms"); + $results = $this->_getIndexForTest()->search($query)->getAggregation('terms'); $this->assertEquals(2, $results['buckets'][0]['doc_count']); - $this->assertEquals("blue", $results['buckets'][0]['key']); + $this->assertEquals('blue', $results['buckets'][0]['key']); } } -
\ No newline at end of file |