public function SearchApiElasticsearchElasticaTest::testDeleteAllItemsFromAllIndexes in Search API Elasticsearch 7
testDeleteAllItemsFromAllIndexes
@dataProvider transportProvider @access public
Return value
void
File
- modules/
elastica/ tests/ phpunit/ SearchApiElasticsearchElasticaTest.php, line 294 - Contains tests for SearchApiElasticsearchElastica.
Class
- SearchApiElasticsearchElasticaTest
- @file Contains tests for SearchApiElasticsearchElastica.
Code
public function testDeleteAllItemsFromAllIndexes($transport) {
$this->_client
->setTransport($transport);
$result_set = $this->_client
->getElasticaType($this->_index)
->search('batman');
$this
->assertEquals(1, $result_set
->count());
$result = $result_set
->current();
$this
->assertNotFalse($result);
$this
->assertEquals(1, $result
->getId());
$result_set = $this->_client
->getElasticaType($this->_index)
->search('robin');
$this
->assertEquals(1, $result_set
->count());
$result = $result_set
->current();
$this
->assertNotFalse($result);
$this
->assertEquals(2, $result
->getId());
$result_set = $this->_client
->getElasticaType($this->_index)
->search('catwoman');
$this
->assertEquals(1, $result_set
->count());
$result = $result_set
->current();
$this
->assertNotFalse($result);
$this
->assertEquals(3, $result
->getId());
$this->_client
->deleteItems('all');
$this->_client
->getElasticaIndex($this->_index)
->refresh();
$this
->markTestIncomplete('This test is currently incomplete.');
$result_set = $this->_client
->getElasticaType($this->_index)
->search('batman');
$this
->assertEquals(0, $result_set
->count());
$result_set = $this->_client
->getElasticaType($this->_index)
->search('robin');
$this
->assertEquals(0, $result_set
->count());
$result_set = $this->_client
->getElasticaType($this->_index)
->search('catwoman');
$this
->assertEquals(0, $result_set
->count());
}