Skip to content

Commit 3fb1ecf

Browse files
committed
Fixing unit tests.
1 parent 41ced2e commit 3fb1ecf

File tree

14 files changed

+30
-30
lines changed

14 files changed

+30
-30
lines changed

app/code/Magento/Cms/Controller/Adminhtml/Block/Delete.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ public function execute()
2626
$model->load($id);
2727
$model->delete();
2828
// display success message
29-
$this->messageManager->addSuccess(__('You deleted the block.'));
29+
$this->messageManager->addSuccessMessage(__('You deleted the block.'));
3030
// go to grid
3131
return $resultRedirect->setPath('*/*/');
3232
} catch (\Exception $e) {
3333
// display error message
34-
$this->messageManager->addError($e->getMessage());
34+
$this->messageManager->addErrorMessage($e->getMessage());
3535
// go back to edit form
3636
return $resultRedirect->setPath('*/*/edit', ['block_id' => $id]);
3737
}
3838
}
3939
// display error message
40-
$this->messageManager->addError(__('We can\'t find a block to delete.'));
40+
$this->messageManager->addErrorMessage(__('We can\'t find a block to delete.'));
4141
// go to grid
4242
return $resultRedirect->setPath('*/*/');
4343
}

app/code/Magento/Cms/Controller/Adminhtml/Block/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function execute()
4242
if ($id) {
4343
$model->load($id);
4444
if (!$model->getId()) {
45-
$this->messageManager->addError(__('This block no longer exists.'));
45+
$this->messageManager->addErrorMessage(__('This block no longer exists.'));
4646
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
4747
$resultRedirect = $this->resultRedirectFactory->create();
4848
return $resultRedirect->setPath('*/*/');

app/code/Magento/Cms/Controller/Adminhtml/Block/InlineEdit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(
4343
$this->blockRepository = $blockRepository;
4444
$this->jsonFactory = $jsonFactory;
4545
}
46-
46+
4747
/**
4848
* @return \Magento\Framework\Controller\ResultInterface
4949
* @throws \Magento\Framework\Exception\LocalizedException

app/code/Magento/Cms/Controller/Adminhtml/Page/InlineEdit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(
5454
$this->pageRepository = $pageRepository;
5555
$this->jsonFactory = $jsonFactory;
5656
}
57-
57+
5858
/**
5959
* @return \Magento\Framework\Controller\ResultInterface
6060
* @throws \Magento\Framework\Exception\LocalizedException

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function execute()
3939
try {
4040
$this->_objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class)->getCurrentPath();
4141
} catch (\Exception $e) {
42-
$this->messageManager->addError($e->getMessage());
42+
$this->messageManager->addErrorMessage($e->getMessage());
4343
}
4444
$this->_initAction();
4545
/** @var \Magento\Framework\View\Result\Layout $resultLayout */

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Block/DeleteTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ public function testDeleteAction()
134134
->with($this->blockId);
135135

136136
$this->messageManagerMock->expects($this->once())
137-
->method('addSuccess')
137+
->method('addSuccessMessage')
138138
->with(__('You deleted the block.'));
139139
$this->messageManagerMock->expects($this->never())
140-
->method('addError');
140+
->method('addErrorMessage');
141141

142142
$this->resultRedirectMock->expects($this->once())
143143
->method('setPath')
@@ -154,10 +154,10 @@ public function testDeleteActionNoId()
154154
->willReturn(null);
155155

156156
$this->messageManagerMock->expects($this->once())
157-
->method('addError')
157+
->method('addErrorMessage')
158158
->with(__('We can\'t find a block to delete.'));
159159
$this->messageManagerMock->expects($this->never())
160-
->method('addSuccess');
160+
->method('addSuccessMessage');
161161

162162
$this->resultRedirectMock->expects($this->once())
163163
->method('setPath')
@@ -181,10 +181,10 @@ public function testDeleteActionThrowsException()
181181
->willThrowException(new \Exception(__($errorMsg)));
182182

183183
$this->messageManagerMock->expects($this->once())
184-
->method('addError')
184+
->method('addErrorMessage')
185185
->with($errorMsg);
186186
$this->messageManagerMock->expects($this->never())
187-
->method('addSuccess');
187+
->method('addSuccessMessage');
188188

189189
$this->resultRedirectMock->expects($this->once())
190190
->method('setPath')

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Block/EditTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testEditActionBlockNoExists()
139139
->willReturn(null);
140140

141141
$this->messageManagerMock->expects($this->once())
142-
->method('addError')
142+
->method('addErrorMessage')
143143
->with(__('This block no longer exists.'));
144144

145145
$this->resultRedirectFactoryMock->expects($this->atLeastOnce())

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Block/MassDeleteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function testMassDeleteAction()
6868
->willReturn(new \ArrayIterator($collection));
6969

7070
$this->messageManagerMock->expects($this->once())
71-
->method('addSuccess')
71+
->method('addSuccessMessage')
7272
->with(__('A total of %1 record(s) have been deleted.', $deletedBlocksCount));
73-
$this->messageManagerMock->expects($this->never())->method('addError');
73+
$this->messageManagerMock->expects($this->never())->method('addErrorMessage');
7474

7575
$this->resultRedirectMock->expects($this->once())
7676
->method('setPath')

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Page/DeleteTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ public function testDeleteAction()
124124
->method('delete');
125125

126126
$this->messageManagerMock->expects($this->once())
127-
->method('addSuccess')
127+
->method('addSuccessMessage')
128128
->with(__('The page has been deleted.'));
129129
$this->messageManagerMock->expects($this->never())
130-
->method('addError');
130+
->method('addErrorMessage');
131131

132132
$this->eventManagerMock->expects($this->once())
133133
->method('dispatch')
@@ -151,10 +151,10 @@ public function testDeleteActionNoId()
151151
->willReturn(null);
152152

153153
$this->messageManagerMock->expects($this->once())
154-
->method('addError')
154+
->method('addErrorMessage')
155155
->with(__('We can\'t find a page to delete.'));
156156
$this->messageManagerMock->expects($this->never())
157-
->method('addSuccess');
157+
->method('addSuccessMessage');
158158

159159
$this->resultRedirectMock->expects($this->once())
160160
->method('setPath')
@@ -195,10 +195,10 @@ public function testDeleteActionThrowsException()
195195
);
196196

197197
$this->messageManagerMock->expects($this->once())
198-
->method('addError')
198+
->method('addErrorMessage')
199199
->with($errorMsg);
200200
$this->messageManagerMock->expects($this->never())
201-
->method('addSuccess');
201+
->method('addSuccessMessage');
202202

203203
$this->resultRedirectMock->expects($this->once())
204204
->method('setPath')

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Page/EditTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testEditActionPageNoExists()
139139
->willReturn(null);
140140

141141
$this->messageManagerMock->expects($this->once())
142-
->method('addError')
142+
->method('addErrorMessage')
143143
->with(__('This page no longer exists.'));
144144

145145
$this->resultRedirectFactoryMock->expects($this->atLeastOnce())

0 commit comments

Comments
 (0)