diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Util/GenerationErrorHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Util/GenerationErrorHandlerTest.php index 70b354687..470d84041 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Util/GenerationErrorHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Util/GenerationErrorHandlerTest.php @@ -3,10 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace tests\unit\Magento\FunctionalTestFramework\Util; -use AspectMock\Test as AspectMock; +use ReflectionProperty; use tests\unit\Util\MagentoTestCase; use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler; use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig; @@ -21,10 +22,9 @@ class GenerationErrorHandlerTest extends MagentoTestCase */ public function testGetDistinctErrors() { - AspectMock::double( - MftfApplicationConfig::class, - ['getPhase' => MftfApplicationConfig::GENERATION_PHASE] - ); + $this->createMock(MftfApplicationConfig::class) + ->method('getPhase') + ->willReturn(MftfApplicationConfig::GENERATION_PHASE); $expectedAllErrors = [ 'test' => [ @@ -79,10 +79,9 @@ public function testGetDistinctErrors() */ public function testGetErrorsWithSameKey() { - AspectMock::double( - MftfApplicationConfig::class, - ['getPhase' => MftfApplicationConfig::GENERATION_PHASE] - ); + $this->createMock(MftfApplicationConfig::class) + ->method('getPhase') + ->willReturn(MftfApplicationConfig::GENERATION_PHASE); $expectedAllErrors = [ 'test' => [ @@ -163,10 +162,9 @@ public function testGetErrorsWithSameKey() */ public function testGetAllErrorsDuplicate() { - AspectMock::double( - MftfApplicationConfig::class, - ['getPhase' => MftfApplicationConfig::GENERATION_PHASE] - ); + $this->createMock(MftfApplicationConfig::class) + ->method('getPhase') + ->willReturn(MftfApplicationConfig::GENERATION_PHASE); $expectedAllErrors = [ 'test' => [ @@ -254,7 +252,7 @@ public function testGetAllErrorMessages($expectedErrMessages, $errors) $handler = GenerationErrorHandler::getInstance(); $handler->reset(); - $property = new \ReflectionProperty(GenerationErrorHandler::class, 'errors'); + $property = new ReflectionProperty(GenerationErrorHandler::class, 'errors'); $property->setAccessible(true); $property->setValue($handler, $errors); @@ -334,10 +332,9 @@ public function getAllErrorMessagesDataProvider() */ public function testResetError() { - AspectMock::double( - MftfApplicationConfig::class, - ['getPhase' => MftfApplicationConfig::GENERATION_PHASE] - ); + $this->createMock(MftfApplicationConfig::class) + ->method('getPhase') + ->willReturn(MftfApplicationConfig::GENERATION_PHASE); GenerationErrorHandler::getInstance()->addError('something', 'some', 'error'); GenerationErrorHandler::getInstance()->addError('otherthing', 'other', 'error'); @@ -353,7 +350,7 @@ public function testResetError() public function tearDown(): void { - $property = new \ReflectionProperty(GenerationErrorHandler::class, 'instance'); + $property = new ReflectionProperty(GenerationErrorHandler::class, 'instance'); $property->setAccessible(true); $property->setValue(null); }