Exemplo n.º 1
0
 protected function setUp()
 {
     parent::setUp();
     $this->_snapshot = new Snapshot($this->_getClient());
     $this->_index = $this->_createIndex();
     $this->_docs = array(new Document('1', array('city' => 'San Diego')), new Document('2', array('city' => 'San Luis Obispo')), new Document('3', array('city' => 'San Francisco')));
     $this->_index->getType('test')->addDocuments($this->_docs);
     $this->_index->refresh();
 }
 protected function setUp()
 {
     $this->markTestSkipped('Snapshot tests currently skipped because not working on Travis');
     parent::setUp();
     $this->_snapshot = new Snapshot($this->_getClient());
     $this->_index = $this->_createIndex();
     $this->_docs = array(new Document('1', array('city' => 'San Diego')), new Document('2', array('city' => 'San Luis Obispo')), new Document('3', array('city' => 'San Francisco')));
     $this->_index->getType('test')->addDocuments($this->_docs);
     $this->_index->refresh();
 }
Exemplo n.º 3
0
 protected function setUp()
 {
     parent::setUp();
     $data = array('cluster_name' => 'test_cluster', 'status' => 'green', 'timed_out' => false, 'number_of_nodes' => 10, 'number_of_data_nodes' => 8, 'active_primary_shards' => 3, 'active_shards' => 4, 'relocating_shards' => 2, 'initializing_shards' => 7, 'unassigned_shards' => 5, 'indices' => array('index_one' => array(), 'index_two' => array()));
     $health = $this->getMockBuilder('Elastica\\Cluster\\Health')->setConstructorArgs(array($this->_getClient()))->setMethods(array('_retrieveHealthData'))->getMock();
     $health->expects($this->any())->method('_retrieveHealthData')->will($this->returnValue($data));
     // need to explicitly refresh because the mocking won't refresh the data in the constructor
     $health->refresh();
     $this->_health = $health;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex('test_suggest_phrase');
     $docs = array();
     $docs[] = new Document(1, array('text' => 'Github is pretty cool'));
     $docs[] = new Document(2, array('text' => 'Elasticsearch is bonsai cool'));
     $docs[] = new Document(3, array('text' => 'This is a test phrase'));
     $docs[] = new Document(4, array('text' => 'Another sentence for testing'));
     $docs[] = new Document(5, array('text' => 'Some more words here'));
     $type = $this->_index->getType(self::TEST_TYPE);
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex('test_suggest');
     $docs = array();
     $docs[] = new Document(1, array('id' => 1, 'text' => 'GitHub'));
     $docs[] = new Document(2, array('id' => 1, 'text' => 'Elastic'));
     $docs[] = new Document(3, array('id' => 1, 'text' => 'Search'));
     $docs[] = new Document(4, array('id' => 1, 'text' => 'Food'));
     $docs[] = new Document(5, array('id' => 1, 'text' => 'Flood'));
     $docs[] = new Document(6, array('id' => 1, 'text' => 'Folks'));
     $type = $this->_index->getType(self::TEST_TYPE);
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
Exemplo n.º 6
0
 protected function setUp()
 {
     parent::setUp();
     $index = $this->_createIndex();
     $type1 = $index->getType('helloworld1');
     $type2 = $index->getType('helloworld2');
     $doc = new Document(1, array('name' => 'hello world'));
     $type1->addDocument($doc);
     $doc = new Document(2, array('name' => 'nicolas ruflin'));
     $type1->addDocument($doc);
     $doc = new Document(3, array('name' => 'ruflin'));
     $type1->addDocument($doc);
     $doc = new Document(4, array('name' => 'hello world again'));
     $type2->addDocument($doc);
     $index->refresh();
     $this->_type = $type1;
     $this->_index = $index;
 }
Exemplo n.º 7
0
 protected function setUp()
 {
     parent::setUp();
     $this->_testFileContent = base64_encode(file_get_contents(BASE_PATH . '/data/test.jpg'));
 }
Exemplo n.º 8
0
 protected function tearDown()
 {
     parent::tearDown();
     putenv('http_proxy=');
 }
Exemplo n.º 9
0
 protected function tearDown()
 {
     $this->_index1->delete();
     $this->_index2->delete();
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     $shardData = array('status' => 'red', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 1);
     $this->_shard = new HealthShard(2, $shardData);
 }
 protected function _createIndex($name = 'test', $delete = true, $shards = 1)
 {
     return parent::_createIndex('test_aggregation_' . $name, $delete, $shards);
 }
 public function setUp()
 {
     parent::setUp();
     $data = array('status' => 'yellow', 'number_of_shards' => 1, 'number_of_replicas' => 2, 'active_primary_shards' => 3, 'active_shards' => 4, 'relocating_shards' => 5, 'initializing_shards' => 6, 'unassigned_shards' => 7, 'shards' => array('0' => array('status' => 'yellow', 'primary_active' => false, 'active_shards' => 0, 'relocating_shards' => 1, 'initializing_shards' => 0, 'unassigned_shards' => 1), '1' => array('status' => 'yellow', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 1), '2' => array('status' => 'green', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 0)));
     $this->_index = new HealthIndex('test', $data);
 }
Exemplo n.º 13
0
 protected function setUp()
 {
     parent::setUp();
     $this->es20('Benchmarks currently skipped with es2.0');
 }
Exemplo n.º 14
0
        $stub->addFilter($filter);
        $expected = array($stub->getBaseName() => array($filter->toArray()));
        $this->assertEquals($expected, $stub->toArray());
    }
    /**
     * @group unit
     */
    public function testToArrayWithParam()
    {
        $stub = $this->getStub();
        $stub->setCached(true);
        $filter = new MatchAll();
        $stub->addFilter($filter);
        $expected = array($stub->getBaseName() => array('_cache' => true, 'filters' => array($filter->toArray())));
        $this->assertEquals($expected, $stub->toArray());
    }
    private function getStub()
    {
        return $this->getMockForAbstractClass('Elastica\\Test\\Filter\\AbstractMultiDebug');
    }
}
Base::hideDeprecated();
class AbstractMultiDebug extends AbstractMulti
{
    public function getBaseName()
    {
        return parent::_getBaseName();
    }
}
Base::showDeprecated();
 protected function setUp()
 {
     parent::setUp();
     $this->markTestIncomplete('Benchmarks currently skipped with es2.0. Has to be reworked');
 }
 protected function tearDown()
 {
     $this->index->delete();
     parent::tearDown();
 }
Exemplo n.º 17
0
 protected function _createIndex($name = null, $delete = true, $shards = 1)
 {
     $index = parent::_createIndex($name, $delete, $shards);
     $type = $index->getType('.percolator');
     $mapping = new Type\Mapping($type, array('name' => array('type' => 'string'), 'field1' => array('type' => 'string')));
     $mapping->disableSource();
     $type->setMapping($mapping);
     return $index;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("rescore_test");
     $this->_index->refresh();
 }