diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php index 5c6fe13d..650a4655 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/AvgTest.php @@ -1,38 +1,39 @@ <?php - namespace Elastica\Test\Aggregation; - use Elastica\Aggregation\Avg; use Elastica\Document; -use Elastica\Index; use Elastica\Query; class AvgTest extends BaseAggregationTest { - protected function setUp() + protected function _getIndexForTest() { - parent::setUp(); - $this->_index = $this->_createIndex('avg'); - $docs = array( - new Document('1', array('price' => 5)), - new Document('2', array('price' => 8)), - new Document('3', array('price' => 1)), - new Document('4', array('price' => 3)), - ); - $this->_index->getType('test')->addDocuments($docs); - $this->_index->refresh(); + $index = $this->_createIndex(); + + $index->getType('test')->addDocuments(array( + new Document(1, array('price' => 5)), + new Document(2, array('price' => 8)), + new Document(3, array('price' => 1)), + new Document(4, array('price' => 3)), + )); + + $index->refresh(); + + return $index; } + /** + * @group functional + */ public function testAvgAggregation() { - $agg = new Avg("avg"); + $agg = new Avg('avg'); $agg->setField('price'); $query = new Query(); $query->addAggregation($agg); - $results = $this->_index->search($query)->getAggregations(); + $results = $this->_getIndexForTest()->search($query)->getAggregations(); $this->assertEquals((5 + 8 + 1 + 3) / 4.0, $results['avg']['value']); } } -
\ No newline at end of file |