Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ public function execute()
}
$sitemap->delete();
// display success message
$this->messageManager->addSuccess(__('You deleted the sitemap.'));
$this->messageManager->addSuccessMessage(__('You deleted the sitemap.'));
// go to grid
$this->_redirect('adminhtml/*/');
return;
} catch (\Exception $e) {
// display error message
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
// go back to edit form
$this->_redirect('adminhtml/*/edit', ['sitemap_id' => $id]);
return;
}
}
// display error message
$this->messageManager->addError(__('We can\'t find a sitemap to delete.'));
$this->messageManager->addErrorMessage(__('We can\'t find a sitemap to delete.'));
// go to grid
$this->_redirect('adminhtml/*/');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function execute()
if ($id) {
$model->load($id);
if (!$model->getId()) {
$this->messageManager->addError(__('This sitemap no longer exists.'));
$this->messageManager->addErrorMessage(__('This sitemap no longer exists.'));
$this->_redirect('adminhtml/*/');
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ public function execute()
);
$sitemap->generateXml();

$this->messageManager->addSuccess(
$this->messageManager->addSuccessMessage(
__('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())
);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('We can\'t generate the sitemap right now.'));
$this->messageManager->addExceptionMessage($e, __('We can\'t generate the sitemap right now.'));
} finally {
$this->appEmulation->stopEnvironmentEmulation();
}
} else {
$this->messageManager->addError(__('We can\'t find a sitemap to generate.'));
$this->messageManager->addErrorMessage(__('We can\'t find a sitemap to generate.'));
}

// go to grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function validatePath(array $data)
$validator->setPaths($helper->getValidPaths());
if (!$validator->isValid($path)) {
foreach ($validator->getMessages() as $message) {
$this->messageManager->addError($message);
$this->messageManager->addErrorMessage($message);
}
// save data in session
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData($data);
Expand Down Expand Up @@ -83,13 +83,13 @@ protected function saveData($data)
// save the data
$model->save();
// display success message
$this->messageManager->addSuccess(__('You saved the sitemap.'));
$this->messageManager->addSuccessMessage(__('You saved the sitemap.'));
// clear previously saved data from session
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData(false);
return $model->getId();
} catch (\Exception $e) {
// display error message
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
// save data in session
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData($data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function testTryToSaveInvalidDataShouldFailWithErrors()
->willReturnMap([[$helperClass, $helper], [$sessionClass, $session]]);

$this->messageManagerMock->expects($this->at(0))
->method('addError')
->method('addErrorMessage')
->withConsecutive(
[$messages[0]],
[$messages[1]]
Expand Down