10
10
use ReflectionProperty ;
11
11
use tests \unit \Util \MagentoTestCase ;
12
12
use Magento \FunctionalTestingFramework \Util \GenerationErrorHandler ;
13
- use Magento \FunctionalTestingFramework \Config \MftfApplicationConfig ;
14
13
15
14
/**
16
15
* Class GenerationErrorHandlerTest
@@ -20,12 +19,8 @@ class GenerationErrorHandlerTest extends MagentoTestCase
20
19
/**
21
20
* Test get errors when all errors are distinct
22
21
*/
23
- public function testGetDistinctErrors ()
22
+ public function testGetDistinctErrors (): void
24
23
{
25
- $ this ->createMock (MftfApplicationConfig::class)
26
- ->method ('getPhase ' )
27
- ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
28
-
29
24
$ expectedAllErrors = [
30
25
'test ' => [
31
26
'Sameple1Test ' => [
@@ -77,12 +72,8 @@ public function testGetDistinctErrors()
77
72
/**
78
73
* Test get errors when some errors have the same key
79
74
*/
80
- public function testGetErrorsWithSameKey ()
75
+ public function testGetErrorsWithSameKey (): void
81
76
{
82
- $ this ->createMock (MftfApplicationConfig::class)
83
- ->method ('getPhase ' )
84
- ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
85
-
86
77
$ expectedAllErrors = [
87
78
'test ' => [
88
79
'Sameple1Test ' => [
@@ -160,12 +151,8 @@ public function testGetErrorsWithSameKey()
160
151
/**
161
152
* Test get errors when some errors are duplicate
162
153
*/
163
- public function testGetAllErrorsDuplicate ()
154
+ public function testGetAllErrorsDuplicate (): void
164
155
{
165
- $ this ->createMock (MftfApplicationConfig::class)
166
- ->method ('getPhase ' )
167
- ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
168
-
169
156
$ expectedAllErrors = [
170
157
'test ' => [
171
158
'Sameple1Test ' => [
@@ -245,9 +232,11 @@ public function testGetAllErrorsDuplicate()
245
232
*
246
233
* @param string $expectedErrMessages
247
234
* @param array $errors
235
+ *
236
+ * @return void
248
237
* @dataProvider getAllErrorMessagesDataProvider
249
238
*/
250
- public function testGetAllErrorMessages ($ expectedErrMessages , $ errors )
239
+ public function testGetAllErrorMessages (string $ expectedErrMessages , array $ errors ): void
251
240
{
252
241
$ handler = GenerationErrorHandler::getInstance ();
253
242
$ handler ->reset ();
@@ -265,7 +254,7 @@ public function testGetAllErrorMessages($expectedErrMessages, $errors)
265
254
*
266
255
* @return array
267
256
*/
268
- public function getAllErrorMessagesDataProvider ()
257
+ public function getAllErrorMessagesDataProvider (): array
269
258
{
270
259
return [
271
260
['' , []],
@@ -330,12 +319,8 @@ public function getAllErrorMessagesDataProvider()
330
319
/**
331
320
* Test reset
332
321
*/
333
- public function testResetError ()
322
+ public function testResetError (): void
334
323
{
335
- $ this ->createMock (MftfApplicationConfig::class)
336
- ->method ('getPhase ' )
337
- ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
338
-
339
324
GenerationErrorHandler::getInstance ()->addError ('something ' , 'some ' , 'error ' );
340
325
GenerationErrorHandler::getInstance ()->addError ('otherthing ' , 'other ' , 'error ' );
341
326
GenerationErrorHandler::getInstance ()->reset ();
@@ -348,6 +333,9 @@ public function testResetError()
348
333
$ this ->assertEquals ([], GenerationErrorHandler::getInstance ()->getErrorsByType ('nothing ' ));
349
334
}
350
335
336
+ /**
337
+ * @inheritdoc
338
+ */
351
339
public function tearDown (): void
352
340
{
353
341
$ property = new ReflectionProperty (GenerationErrorHandler::class, 'instance ' );
0 commit comments