1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8class Search_Elastic_BulkIncrementalUpdateTest extends Search_Index_IncrementalUpdateTest 9{ 10 protected $index; 11 12 function setUp() 13 { 14 $this->index = $this->getIndex(); 15 $this->index->destroy(); 16 17 $this->populate($this->index); 18 } 19 20 protected function getIndex() 21 { 22 $elasticSearchHost = empty(getenv('ELASTICSEARCH_HOST')) ? 'localhost' : getenv('ELASTICSEARCH_HOST'); 23 $connection = new Search_Elastic_Connection('http://' . $elasticSearchHost . ':9200'); 24 $connection->startBulk(100); 25 26 $status = $connection->getStatus(); 27 if (! $status->ok) { 28 $this->markTestSkipped('Elasticsearch needs to be available on ' . $elasticSearchHost . ':9200 for the test to run.'); 29 } 30 31 return new Search_Elastic_Index($connection, 'test_index'); 32 } 33 34 function tearDown() 35 { 36 if ($this->index) { 37 $this->index->destroy(); 38 } 39 } 40} 41