Skip to content

Commit 1b63568

Browse files
author
Yurii Torbyk
committed
MAGETWO-34991: Eliminate exceptions from the list Part2
1 parent 9648217 commit 1b63568

File tree

15 files changed

+22
-20
lines changed

15 files changed

+22
-20
lines changed

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/UpdateQtyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function testExecute()
264264
*/
265265
public function testExecuteModelException()
266266
{
267-
$message = 'Cannot update item quantity.';
267+
$message = 'The order no longer exists.';
268268
$response = ['error' => true, 'message' => $message];
269269

270270
$orderMock = $this->getMockBuilder('Magento\Sales\Model\Order')
@@ -307,7 +307,7 @@ public function testExecuteModelException()
307307
*/
308308
public function testExecuteException()
309309
{
310-
$message = 'Cannot update item quantity.';
310+
$message = 'The order no longer exists.';
311311
$response = ['error' => true, 'message' => $message];
312312

313313
$orderMock = $this->getMockBuilder('Magento\Sales\Model\Order')

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function getAsConfigFileDataProvider()
199199
*/
200200
public function testGetAsConfigFileException($settingName, $expectedExceptionMsg)
201201
{
202-
$this->setExpectedException('Magento\Framework\Exception', $expectedExceptionMsg);
202+
$this->setExpectedException('Magento\Framework\Exception\LocalizedException', $expectedExceptionMsg);
203203
$this->_object->getAsConfigFile($settingName);
204204
}
205205

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function crudDataProvider()
6666
{
6767
return [
6868
'successful CRUD' => ['saveModelSuccessfully'],
69-
'cleanup on update error' => ['saveModelAndFailOnUpdate', 'Magento\Framework\Exception']
69+
'cleanup on update error' => ['saveModelAndFailOnUpdate', 'Magento\Framework\Exception\LocalizedException']
7070
];
7171
}
7272

dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public function testAddContainerInvalidHtmlTag()
274274
$msg = 'Html tag "span" is forbidden for usage in containers. ' .
275275
'Consider to use one of the allowed: dd, div, dl, fieldset, main, header, ' .
276276
'footer, ol, p, section, table, tfoot, ul.';
277-
$this->setExpectedException('Magento\Framework\Exception', $msg);
277+
$this->setExpectedException('Magento\Framework\Exception\LocalizedException', $msg);
278278
$this->_layout->addContainer('container', 'Container', ['htmlTag' => 'span']);
279279
}
280280

dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function constructorExceptionDataProvider()
7070
'non-existing base dir' => [
7171
require __DIR__ . '/_files/config_data.php',
7272
'non_existing_dir',
73-
'Magento\Framework\Exception',
73+
'Magento\Framework\Exception\LocalizedException',
7474
"Base directory 'non_existing_dir' does not exist",
7575
],
7676
'invalid scenarios format' => [

dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/Scenario/Handler/JmeterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function runExceptionDataProvider()
132132
'no report created' => [
133133
"{$fixtureDir}/scenario_without_report.jmx",
134134
"{$fixtureDir}/scenario_without_report.jtl",
135-
'Magento\Framework\Exception',
135+
'Magento\Framework\Exception\LocalizedException',
136136
"Report file '{$fixtureDir}/scenario_without_report.jtl' for 'Scenario' has not been created.",
137137
],
138138
'scenario failure in report' => [

dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2424,7 +2424,8 @@
24242424
['Magento\Archive', 'Magento\Framework\Archive'],
24252425
['Magento\Event', 'Magento\Framework\Event'],
24262426
['Magento\EventFactory', 'Magento\Framework\EventFactory'],
2427-
['Magento\Exception', 'Magento\Framework\Exception'],
2427+
['Magento\Exception', 'Magento\Framework\Exception\LocalizedException'],
2428+
['Magento\Framework\Exception', 'Magento\Framework\Exception\LocalizedException'],
24282429
['Magento\Filesystem', 'Magento\Framework\Filesystem'],
24292430
['Magento\ObjectManager', 'Magento\Framework\ObjectManagerInterface'],
24302431
['Magento\Translate', 'Magento\Framework\Translate'],

dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
['Magento\Session', 'Magento\Framework\Session'],
2121
['Magento\Cache', 'Magento\Framework\Cache'],
2222
['Magento\ObjectManager', 'Magento\Framework\ObjectManager'],
23-
['Magento\Exception', 'Magento\Framework\Exception'],
23+
['Magento\Exception', 'Magento\Framework\Exception\LocalizedException'],
24+
['Magento\Framework\Exception', 'Magento\Framework\Exception\LocalizedException'],
2425
['Magento\Autoload', 'Magento\Framework\Autoload'],
2526
['Magento\Translate', 'Magento\Framework\Translate'],
2627
['Magento\Code', 'Magento\Framework\Code'],

lib/internal/Magento/Framework/App/Test/Unit/StateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public function testSetAreaCode()
4343
$areaCode = 'some code';
4444
$this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode);
4545
$this->model->setAreaCode($areaCode);
46-
$this->setExpectedException('Magento\Framework\Exception');
46+
$this->setExpectedException('Magento\Framework\Exception\LocalizedException');
4747
$this->model->setAreaCode('any code');
4848
}
4949

5050
public function testGetAreaCodeException()
5151
{
5252
$this->scopeMock->expects($this->never())->method('setCurrentScope');
53-
$this->setExpectedException('Magento\Framework\Exception');
53+
$this->setExpectedException('Magento\Framework\Exception\LocalizedException');
5454
$this->model->getAreaCode();
5555
}
5656

lib/internal/Magento/Framework/Convert/ConvertArray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ConvertArray
2424
public function assocToXml(array $array, $rootName = '_')
2525
{
2626
if (empty($rootName) || is_numeric($rootName)) {
27-
throw new LocalizedException('Root element must not be empty or numeric');
27+
throw new LocalizedException(new \Magento\Framework\Phrase('Root element must not be empty or numeric'));
2828
}
2929

3030
$xmlStr = <<<XML
@@ -34,7 +34,7 @@ public function assocToXml(array $array, $rootName = '_')
3434
$xml = new \SimpleXMLElement($xmlStr);
3535
foreach (array_keys($array) as $key) {
3636
if (is_numeric($key)) {
37-
throw new LocalizedException('Array root keys must not be numeric.');
37+
throw new LocalizedException(new \Magento\Framework\Phrase('Array root keys must not be numeric.'));
3838
}
3939
}
4040
return self::_assocToXml($array, $rootName, $xml);

0 commit comments

Comments
 (0)