@@ -58,9 +58,6 @@ class ImporterTest extends \PHPUnit_Framework_TestCase
58
58
*/
59
59
private $ importer ;
60
60
61
- /**
62
- * @return void
63
- */
64
61
protected function setUp ()
65
62
{
66
63
$ this ->importerFactoryMock = $ this ->getMockBuilder (ImporterFactory::class)
@@ -94,9 +91,6 @@ protected function setUp()
94
91
);
95
92
}
96
93
97
- /**
98
- * @return void
99
- */
100
94
public function testImport ()
101
95
{
102
96
$ configData = ['some data ' ];
@@ -141,13 +135,12 @@ public function testImport()
141
135
}
142
136
143
137
/**
144
- * @return void
145
138
* @expectedException \Magento\Framework\Exception\LocalizedException
146
139
* @expectedExceptionMessage Import is failed. Please see the log report.
147
140
*/
148
141
public function testImportWithException ()
149
142
{
150
- $ exception = new LocalizedException ( __ ( 'Some error ' ) );
143
+ $ exception = new \ Exception ( 'Some error ' );
151
144
$ this ->outputMock ->expects ($ this ->never ())
152
145
->method ('writeln ' );
153
146
$ this ->configHashMock ->expects ($ this ->never ())
@@ -166,10 +159,31 @@ public function testImportWithException()
166
159
$ this ->importer ->import ($ this ->outputMock );
167
160
}
168
161
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
+
169
184
/**
170
185
* @param array $importers
171
186
* @param bool $isValid
172
- * @return void
173
187
* @dataProvider importNothingToImportDataProvider
174
188
*/
175
189
public function testImportNothingToImport (array $ importers , $ isValid )
0 commit comments