Skip to content

Commit 2fee35a

Browse files
committed
Merge remote-tracking branch 'origin/imported-magento-magento2-functional-testing-framework-834' into MQE-2683
2 parents 009d543 + d0e1304 commit 2fee35a

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/StaticCheck/AnnotationsCheckTest.php

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,27 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace tests\unit\Magento\FunctionalTestFramework\StaticCheck;
89

9-
use AspectMock\Test as AspectMock;
1010
use Magento\FunctionalTestingFramework\StaticCheck\AnnotationsCheck;
1111
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
12-
use tests\unit\Util\MagentoTestCase;
1312
use ReflectionClass;
13+
use tests\unit\Util\MagentoTestCase;
1414

1515
class AnnotationsCheckTest extends MagentoTestCase
1616
{
1717
/** @var AnnotationsCheck */
1818
private $staticCheck;
1919

20-
/** @var ReflectionClass*/
20+
/** @var ReflectionClass */
2121
private $staticCheckClass;
2222

2323
public function setUp(): void
2424
{
2525
$this->staticCheck = new AnnotationsCheck();
26-
$this->staticCheckClass = new \ReflectionClass($this->staticCheck);
27-
}
28-
29-
public function tearDown(): void
30-
{
31-
AspectMock::clean();
26+
$this->staticCheckClass = new ReflectionClass($this->staticCheck);
3227
}
3328

3429
public function testValidateRequiredAnnotationsNoError()
@@ -56,11 +51,9 @@ public function testValidateRequiredAnnotationsNoError()
5651
];
5752
$expected = [];
5853

59-
// mock test object
60-
$test = AspectMock::double(
61-
TestObject::class,
62-
['getAnnotations' => $annotations, 'getName' => 'AnnotationsCheckTest']
63-
)->make();
54+
$test = $this->createMock(TestObject::class);
55+
56+
$test->expects($this->once())->method('getAnnotations')->willReturn($annotations);
6457

6558
$validateRequiredAnnotations = $this->staticCheckClass->getMethod('validateRequiredAnnotations');
6659
$validateRequiredAnnotations->setAccessible(true);
@@ -99,11 +92,10 @@ public function testValidateRequiredAnnotationsMissing()
9992
]
10093
];
10194

102-
// mock test object
103-
$test = AspectMock::double(
104-
TestObject::class,
105-
['getAnnotations' => $annotations, 'getName' => 'AnnotationsCheckTest']
106-
)->make();
95+
$test = $this->createMock(TestObject::class);
96+
97+
$test->expects($this->once())->method('getAnnotations')->willReturn($annotations);
98+
$test->expects($this->once())->method('getName')->willReturn('AnnotationsCheckTest');
10799

108100
$validateRequiredAnnotations = $this->staticCheckClass->getMethod('validateRequiredAnnotations');
109101
$validateRequiredAnnotations->setAccessible(true);
@@ -137,11 +129,10 @@ public function testValidateRequiredAnnotationsMissingNoTestCaseId()
137129
]
138130
];
139131

140-
// mock test object
141-
$test = AspectMock::double(
142-
TestObject::class,
143-
['getAnnotations' => $annotations, 'getName' => 'AnnotationsCheckTest']
144-
)->make();
132+
$test = $this->createMock(TestObject::class);
133+
134+
$test->expects($this->once())->method('getAnnotations')->willReturn($annotations);
135+
$test->expects($this->once())->method('getName')->willReturn('AnnotationsCheckTest');
145136

146137
$validateRequiredAnnotations = $this->staticCheckClass->getMethod('validateRequiredAnnotations');
147138
$validateRequiredAnnotations->setAccessible(true);
@@ -179,11 +170,10 @@ public function testValidateRequiredAnnotationsEmpty()
179170
]
180171
];
181172

182-
// mock test object
183-
$test = AspectMock::double(
184-
TestObject::class,
185-
['getAnnotations' => $annotations, 'getName' => 'AnnotationsCheckTest']
186-
)->make();
173+
$test = $this->createMock(TestObject::class);
174+
175+
$test->expects($this->once())->method('getAnnotations')->willReturn($annotations);
176+
$test->expects($this->once())->method('getName')->willReturn('AnnotationsCheckTest');
187177

188178
$validateRequiredAnnotations = $this->staticCheckClass->getMethod('validateRequiredAnnotations');
189179
$validateRequiredAnnotations->setAccessible(true);

0 commit comments

Comments
 (0)