public function SearchApiElasticsearchElasticaTest::testDeleteAllItems in Search API Elasticsearch 7
testDeleteAllItems
@dataProvider transportProvider @access public
Return value
void
File
- modules/
elastica/ tests/ phpunit/ SearchApiElasticsearchElasticaTest.php, line 260 - Contains tests for SearchApiElasticsearchElastica.
Class
- SearchApiElasticsearchElasticaTest
- @file Contains tests for SearchApiElasticsearchElastica.
Code
public function testDeleteAllItems($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->_index);
$this->_client
->getElasticaIndex($this->_index)
->refresh();
$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());
}