3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
8
namespace tests \unit \Magento \FunctionalTestFramework \Util ;
8
9
9
- use AspectMock \ Test as AspectMock ;
10
+ use ReflectionProperty ;
10
11
use tests \unit \Util \MagentoTestCase ;
11
12
use Magento \FunctionalTestingFramework \Util \GenerationErrorHandler ;
12
13
use Magento \FunctionalTestingFramework \Config \MftfApplicationConfig ;
@@ -21,10 +22,9 @@ class GenerationErrorHandlerTest extends MagentoTestCase
21
22
*/
22
23
public function testGetDistinctErrors ()
23
24
{
24
- AspectMock::double (
25
- MftfApplicationConfig::class,
26
- ['getPhase ' => MftfApplicationConfig::GENERATION_PHASE ]
27
- );
25
+ $ this ->createMock (MftfApplicationConfig::class)
26
+ ->method ('getPhase ' )
27
+ ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
28
28
29
29
$ expectedAllErrors = [
30
30
'test ' => [
@@ -79,10 +79,9 @@ public function testGetDistinctErrors()
79
79
*/
80
80
public function testGetErrorsWithSameKey ()
81
81
{
82
- AspectMock::double (
83
- MftfApplicationConfig::class,
84
- ['getPhase ' => MftfApplicationConfig::GENERATION_PHASE ]
85
- );
82
+ $ this ->createMock (MftfApplicationConfig::class)
83
+ ->method ('getPhase ' )
84
+ ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
86
85
87
86
$ expectedAllErrors = [
88
87
'test ' => [
@@ -163,10 +162,9 @@ public function testGetErrorsWithSameKey()
163
162
*/
164
163
public function testGetAllErrorsDuplicate ()
165
164
{
166
- AspectMock::double (
167
- MftfApplicationConfig::class,
168
- ['getPhase ' => MftfApplicationConfig::GENERATION_PHASE ]
169
- );
165
+ $ this ->createMock (MftfApplicationConfig::class)
166
+ ->method ('getPhase ' )
167
+ ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
170
168
171
169
$ expectedAllErrors = [
172
170
'test ' => [
@@ -254,7 +252,7 @@ public function testGetAllErrorMessages($expectedErrMessages, $errors)
254
252
$ handler = GenerationErrorHandler::getInstance ();
255
253
$ handler ->reset ();
256
254
257
- $ property = new \ ReflectionProperty (GenerationErrorHandler::class, 'errors ' );
255
+ $ property = new ReflectionProperty (GenerationErrorHandler::class, 'errors ' );
258
256
$ property ->setAccessible (true );
259
257
$ property ->setValue ($ handler , $ errors );
260
258
@@ -334,10 +332,9 @@ public function getAllErrorMessagesDataProvider()
334
332
*/
335
333
public function testResetError ()
336
334
{
337
- AspectMock::double (
338
- MftfApplicationConfig::class,
339
- ['getPhase ' => MftfApplicationConfig::GENERATION_PHASE ]
340
- );
335
+ $ this ->createMock (MftfApplicationConfig::class)
336
+ ->method ('getPhase ' )
337
+ ->willReturn (MftfApplicationConfig::GENERATION_PHASE );
341
338
342
339
GenerationErrorHandler::getInstance ()->addError ('something ' , 'some ' , 'error ' );
343
340
GenerationErrorHandler::getInstance ()->addError ('otherthing ' , 'other ' , 'error ' );
@@ -353,7 +350,7 @@ public function testResetError()
353
350
354
351
public function tearDown (): void
355
352
{
356
- $ property = new \ ReflectionProperty (GenerationErrorHandler::class, 'instance ' );
353
+ $ property = new ReflectionProperty (GenerationErrorHandler::class, 'instance ' );
357
354
$ property ->setAccessible (true );
358
355
$ property ->setValue (null );
359
356
}
0 commit comments