Skip to content

Commit a4d7c33

Browse files
committed
Merge branch 'PR847' into kevin-unit-test-prs
2 parents 01505ea + 55709f0 commit a4d7c33

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Util/GenerationErrorHandlerTest.php

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use ReflectionProperty;
1111
use tests\unit\Util\MagentoTestCase;
1212
use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler;
13-
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
1413

1514
/**
1615
* Class GenerationErrorHandlerTest
@@ -20,12 +19,8 @@ class GenerationErrorHandlerTest extends MagentoTestCase
2019
/**
2120
* Test get errors when all errors are distinct
2221
*/
23-
public function testGetDistinctErrors()
22+
public function testGetDistinctErrors():void
2423
{
25-
$this->createMock(MftfApplicationConfig::class)
26-
->method('getPhase')
27-
->willReturn(MftfApplicationConfig::GENERATION_PHASE);
28-
2924
$expectedAllErrors = [
3025
'test' => [
3126
'Sameple1Test' => [
@@ -77,12 +72,8 @@ public function testGetDistinctErrors()
7772
/**
7873
* Test get errors when some errors have the same key
7974
*/
80-
public function testGetErrorsWithSameKey()
75+
public function testGetErrorsWithSameKey(): void
8176
{
82-
$this->createMock(MftfApplicationConfig::class)
83-
->method('getPhase')
84-
->willReturn(MftfApplicationConfig::GENERATION_PHASE);
85-
8677
$expectedAllErrors = [
8778
'test' => [
8879
'Sameple1Test' => [
@@ -160,12 +151,8 @@ public function testGetErrorsWithSameKey()
160151
/**
161152
* Test get errors when some errors are duplicate
162153
*/
163-
public function testGetAllErrorsDuplicate()
154+
public function testGetAllErrorsDuplicate(): void
164155
{
165-
$this->createMock(MftfApplicationConfig::class)
166-
->method('getPhase')
167-
->willReturn(MftfApplicationConfig::GENERATION_PHASE);
168-
169156
$expectedAllErrors = [
170157
'test' => [
171158
'Sameple1Test' => [
@@ -245,9 +232,11 @@ public function testGetAllErrorsDuplicate()
245232
*
246233
* @param string $expectedErrMessages
247234
* @param array $errors
235+
*
236+
* @return void
248237
* @dataProvider getAllErrorMessagesDataProvider
249238
*/
250-
public function testGetAllErrorMessages($expectedErrMessages, $errors)
239+
public function testGetAllErrorMessages(string $expectedErrMessages, array $errors): void
251240
{
252241
$handler = GenerationErrorHandler::getInstance();
253242
$handler->reset();
@@ -265,7 +254,7 @@ public function testGetAllErrorMessages($expectedErrMessages, $errors)
265254
*
266255
* @return array
267256
*/
268-
public function getAllErrorMessagesDataProvider()
257+
public function getAllErrorMessagesDataProvider(): array
269258
{
270259
return [
271260
['', []],
@@ -330,12 +319,8 @@ public function getAllErrorMessagesDataProvider()
330319
/**
331320
* Test reset
332321
*/
333-
public function testResetError()
322+
public function testResetError(): void
334323
{
335-
$this->createMock(MftfApplicationConfig::class)
336-
->method('getPhase')
337-
->willReturn(MftfApplicationConfig::GENERATION_PHASE);
338-
339324
GenerationErrorHandler::getInstance()->addError('something', 'some', 'error');
340325
GenerationErrorHandler::getInstance()->addError('otherthing', 'other', 'error');
341326
GenerationErrorHandler::getInstance()->reset();
@@ -348,6 +333,9 @@ public function testResetError()
348333
$this->assertEquals([], GenerationErrorHandler::getInstance()->getErrorsByType('nothing'));
349334
}
350335

336+
/**
337+
* @inheritdoc
338+
*/
351339
public function tearDown(): void
352340
{
353341
$property = new ReflectionProperty(GenerationErrorHandler::class, 'instance');

0 commit comments

Comments
 (0)