Skip to content

Commit 56d544f

Browse files
author
Bohdan Korablov
committed
MAGETWO-65208: Store checksum for every section of configuration file & change behavior on read-only FS & add sorting of importers
1 parent e481fe6 commit 56d544f

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

app/code/Magento/Deploy/Console/Command/App/ConfigImport/Importer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Framework\App\DeploymentConfig\ImporterInterface;
99
use Magento\Framework\App\DeploymentConfig;
10-
use Magento\Framework\Exception\LocalizedException;
1110
use Magento\Framework\Exception\RuntimeException;
1211
use Psr\Log\LoggerInterface as Logger;
1312
use Magento\Deploy\Model\DeploymentConfig\Validator;
@@ -118,12 +117,9 @@ public function import(OutputInterface $output)
118117
$this->configHash->regenerate($section);
119118
}
120119
}
121-
} catch (LocalizedException $exception) {
122-
$this->logger->error($exception);
123-
$output->writeln(sprintf('<error>%s</error>', $exception->getMessage()));
124120
} catch (\Exception $exception) {
125121
$this->logger->error($exception);
126-
throw new RuntimeException(__('Import is failed. Please see the log report.'), $exception);
122+
throw new RuntimeException(__('Import is failed: %1', $exception->getMessage()), $exception);
127123
}
128124
}
129125
}

app/code/Magento/Deploy/Test/Unit/Console/Command/App/ConfigImport/ImporterTest.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Framework\App\DeploymentConfig\ImporterInterface;
99
use Magento\Framework\App\DeploymentConfig;
10-
use Magento\Framework\Exception\LocalizedException;
1110
use Psr\Log\LoggerInterface as Logger;
1211
use Magento\Deploy\Console\Command\App\ConfigImport\Importer;
1312
use Magento\Deploy\Model\DeploymentConfig\Validator;
@@ -135,8 +134,8 @@ public function testImport()
135134
}
136135

137136
/**
138-
* @expectedException \Magento\Framework\Exception\LocalizedException
139-
* @expectedExceptionMessage Import is failed. Please see the log report.
137+
* @expectedException \Magento\Framework\Exception\RuntimeException
138+
* @expectedExceptionMessage Import is failed: Some error
140139
*/
141140
public function testImportWithException()
142141
{
@@ -159,28 +158,6 @@ public function testImportWithException()
159158
$this->importer->import($this->outputMock);
160159
}
161160

162-
public function testImportWithLocalizedException()
163-
{
164-
$exception = new LocalizedException(__('Some error'));
165-
$this->outputMock->expects($this->once())
166-
->method('writeln')
167-
->with('<error>Some error</error>');
168-
$this->configHashMock->expects($this->never())
169-
->method('regenerate');
170-
$this->configValidatorMock->expects($this->never())
171-
->method('isValid');
172-
$this->deploymentConfigMock->expects($this->never())
173-
->method('getConfigData');
174-
$this->configImporterPoolMock->expects($this->once())
175-
->method('getImporters')
176-
->willThrowException($exception);
177-
$this->loggerMock->expects($this->once())
178-
->method('error')
179-
->with($exception);
180-
181-
$this->importer->import($this->outputMock);
182-
}
183-
184161
/**
185162
* @param array $importers
186163
* @param bool $isValid

0 commit comments

Comments
 (0)