File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed
Controller/Adminhtml/Sitemap
Test/Unit/Controller/Adminhtml/Sitemap Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -65,20 +65,20 @@ public function execute()
65
65
}
66
66
$ sitemap ->delete ();
67
67
// display success message
68
- $ this ->messageManager ->addSuccess (__ ('You deleted the sitemap. ' ));
68
+ $ this ->messageManager ->addSuccessMessage (__ ('You deleted the sitemap. ' ));
69
69
// go to grid
70
70
$ this ->_redirect ('adminhtml/*/ ' );
71
71
return ;
72
72
} catch (\Exception $ e ) {
73
73
// display error message
74
- $ this ->messageManager ->addError ($ e ->getMessage ());
74
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
75
75
// go back to edit form
76
76
$ this ->_redirect ('adminhtml/*/edit ' , ['sitemap_id ' => $ id ]);
77
77
return ;
78
78
}
79
79
}
80
80
// display error message
81
- $ this ->messageManager ->addError (__ ('We can \'t find a sitemap to delete. ' ));
81
+ $ this ->messageManager ->addErrorMessage (__ ('We can \'t find a sitemap to delete. ' ));
82
82
// go to grid
83
83
$ this ->_redirect ('adminhtml/*/ ' );
84
84
}
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public function execute()
41
41
if ($ id ) {
42
42
$ model ->load ($ id );
43
43
if (!$ model ->getId ()) {
44
- $ this ->messageManager ->addError (__ ('This sitemap no longer exists. ' ));
44
+ $ this ->messageManager ->addErrorMessage (__ ('This sitemap no longer exists. ' ));
45
45
$ this ->_redirect ('adminhtml/*/ ' );
46
46
return ;
47
47
}
Original file line number Diff line number Diff line change @@ -52,18 +52,18 @@ public function execute()
52
52
);
53
53
$ sitemap ->generateXml ();
54
54
55
- $ this ->messageManager ->addSuccess (
55
+ $ this ->messageManager ->addSuccessMessage (
56
56
__ ('The sitemap "%1" has been generated. ' , $ sitemap ->getSitemapFilename ())
57
57
);
58
58
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
59
- $ this ->messageManager ->addError ($ e ->getMessage ());
59
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
60
60
} catch (\Exception $ e ) {
61
- $ this ->messageManager ->addException ($ e , __ ('We can \'t generate the sitemap right now. ' ));
61
+ $ this ->messageManager ->addExceptionMessage ($ e , __ ('We can \'t generate the sitemap right now. ' ));
62
62
} finally {
63
63
$ this ->appEmulation ->stopEnvironmentEmulation ();
64
64
}
65
65
} else {
66
- $ this ->messageManager ->addError (__ ('We can \'t find a sitemap to generate. ' ));
66
+ $ this ->messageManager ->addErrorMessage (__ ('We can \'t find a sitemap to generate. ' ));
67
67
}
68
68
69
69
// go to grid
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ protected function validatePath(array $data)
30
30
$ validator ->setPaths ($ helper ->getValidPaths ());
31
31
if (!$ validator ->isValid ($ path )) {
32
32
foreach ($ validator ->getMessages () as $ message ) {
33
- $ this ->messageManager ->addError ($ message );
33
+ $ this ->messageManager ->addErrorMessage ($ message );
34
34
}
35
35
// save data in session
36
36
$ this ->_objectManager ->get (\Magento \Backend \Model \Session::class)->setFormData ($ data );
@@ -83,13 +83,13 @@ protected function saveData($data)
83
83
// save the data
84
84
$ model ->save ();
85
85
// display success message
86
- $ this ->messageManager ->addSuccess (__ ('You saved the sitemap. ' ));
86
+ $ this ->messageManager ->addSuccessMessage (__ ('You saved the sitemap. ' ));
87
87
// clear previously saved data from session
88
88
$ this ->_objectManager ->get (\Magento \Backend \Model \Session::class)->setFormData (false );
89
89
return $ model ->getId ();
90
90
} catch (\Exception $ e ) {
91
91
// display error message
92
- $ this ->messageManager ->addError ($ e ->getMessage ());
92
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
93
93
// save data in session
94
94
$ this ->_objectManager ->get (\Magento \Backend \Model \Session::class)->setFormData ($ data );
95
95
}
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ public function testTryToSaveInvalidDataShouldFailWithErrors()
154
154
->willReturnMap ([[$ helperClass , $ helper ], [$ sessionClass , $ session ]]);
155
155
156
156
$ this ->messageManagerMock ->expects ($ this ->at (0 ))
157
- ->method ('addError ' )
157
+ ->method ('addErrorMessage ' )
158
158
->withConsecutive (
159
159
[$ messages [0 ]],
160
160
[$ messages [1 ]]
You can’t perform that action at this time.
0 commit comments