Skip to content

Commit 777f409

Browse files
committed
Simplify test logic
1 parent 6c321ef commit 777f409

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,14 @@ public function testExecute($indexerIds, $exception)
227227

228228
if ($exception) {
229229
if ($exception instanceof \Magento\Framework\Exception\LocalizedException) {
230-
$expectError = 1;
231-
$expectException = 0;
230+
$this->messageManager->expects($this->exactly(1))
231+
->method('addError')
232+
->with($exception->getMessage());
232233
} else {
233-
$expectError = 0;
234-
$expectException = 1;
234+
$this->messageManager->expects($this->exactly(1))
235+
->method('addException')
236+
->with($exception, "We couldn't invalidate indexer(s) because of an error.");
235237
}
236-
$this->messageManager->expects($this->exactly($expectError))
237-
->method('addError')
238-
->with($exception->getMessage());
239-
$this->messageManager->expects($this->exactly($expectException))
240-
->method('addException')
241-
->with($exception, "We couldn't invalidate indexer(s) because of an error.");
242238
}
243239
}
244240

0 commit comments

Comments
 (0)