Skip to content

Commit 5181b02

Browse files
committed
Resetter tests
1 parent ac98549 commit 5181b02

File tree

2 files changed

+207
-178
lines changed

2 files changed

+207
-178
lines changed

Index/Resetter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ public function resetAllIndexes($populating = false, $force = false)
8686
*/
8787
public function resetIndex($indexName, $populating = false, $force = false)
8888
{
89-
$event = new IndexResetEvent($indexName, $populating, $force);
90-
$this->dispatcher->dispatch(IndexResetEvent::PRE_INDEX_RESET, $event);
91-
9289
$indexConfig = $this->configManager->getIndexConfiguration($indexName);
9390
$index = $this->indexManager->getIndex($indexName);
9491

92+
$event = new IndexResetEvent($indexName, $populating, $force);
93+
$this->dispatcher->dispatch(IndexResetEvent::PRE_INDEX_RESET, $event);
94+
9595
if ($indexConfig->isUseAlias()) {
9696
$this->aliasProcessor->setRootName($indexConfig, $index);
9797
}
@@ -117,12 +117,12 @@ public function resetIndex($indexName, $populating = false, $force = false)
117117
*/
118118
public function resetIndexType($indexName, $typeName)
119119
{
120-
$event = new TypeResetEvent($indexName, $typeName);
121-
$this->dispatcher->dispatch(TypeResetEvent::PRE_TYPE_RESET, $event);
122-
123120
$typeConfig = $this->configManager->getTypeConfiguration($indexName, $typeName);
124121
$type = $this->indexManager->getIndex($indexName)->getType($typeName);
125122

123+
$event = new TypeResetEvent($indexName, $typeName);
124+
$this->dispatcher->dispatch(TypeResetEvent::PRE_TYPE_RESET, $event);
125+
126126
try {
127127
$type->delete();
128128
} catch (ResponseException $e) {

0 commit comments

Comments
 (0)