Skip to content

Commit 1850a3e

Browse files
authored
Merge branch 'develop' into imported-magento-magento2-functional-testing-framework-843
2 parents 1fdb5b9 + 93676a8 commit 1850a3e

26 files changed

+1381
-769
lines changed

Diff for: CHANGELOG.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
Magento Functional Testing Framework Changelog
22
================================================
3+
3.6.0
4+
---------
5+
6+
### Enhancements
7+
8+
* Maintainability
9+
* Updated composer dependencies to be PHP 8 compatible with the except of codeception/aspect-mock.
10+
11+
### GitHub Pull Requests:
12+
13+
* [#830](https://github.com/magento/magento2-functional-testing-framework/pull/830) -- Add ability to configure multiple OTPs
14+
* [#832](https://github.com/magento/magento2-functional-testing-framework/pull/832) -- Updated monolog/monolog to ^2.2
15+
* [#833](https://github.com/magento/magento2-functional-testing-framework/pull/833) -- Removed usage of AspectMock in FilesystemTest
16+
* [#834](https://github.com/magento/magento2-functional-testing-framework/pull/834) -- Removed usage of AspectMock in AnnotationsCheckTest
17+
* [#838](https://github.com/magento/magento2-functional-testing-framework/pull/838) -- Removed usage of AspectMock in DeprecatedEntityUsageCheckTest
18+
* [#841](https://github.com/magento/magento2-functional-testing-framework/pull/841) -- Removed usage of AspectMock in GenerationErrorHandlerTest
19+
* [#854](https://github.com/magento/magento2-functional-testing-framework/pull/854) -- Updated "monolog" to the latest version 2.3.1
20+
321
3.5.1
422
---------
523

624
### GitHub Pull Requests:
725

826
* [#825](https://github.com/magento/magento2-functional-testing-framework/pull/825) -- Update allure-codeception in order to support php8
927

10-
1128
3.5.0
1229
---------
1330

Diff for: composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "3.5.1",
5+
"version": "3.6.0",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {
@@ -25,8 +25,9 @@
2525
"csharpru/vault-php": "^4.2.1",
2626
"csharpru/vault-php-guzzle6-transport": "^2.0",
2727
"hoa/console": "~3.0",
28-
"monolog/monolog": "^2.2",
28+
"monolog/monolog": "^2.3",
2929
"mustache/mustache": "~2.5",
30+
"nikic/php-parser": "^4.4",
3031
"php-webdriver/webdriver": "^1.9.0",
3132
"spomky-labs/otphp": "^10.0",
3233
"symfony/console": "^4.4",
@@ -35,8 +36,7 @@
3536
"symfony/mime": "^5.0",
3637
"symfony/process": "^4.4",
3738
"vlucas/phpdotenv": "^2.4",
38-
"weew/helpers-array": "^1.3",
39-
"nikic/php-parser": "^4.4"
39+
"weew/helpers-array": "^1.3"
4040
},
4141
"require-dev": {
4242
"brainmaestro/composer-git-hooks": "^2.3.1",

Diff for: composer.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dev/tests/unit/Magento/FunctionalTestFramework/Console/BaseGenerateCommandTest.php

+85-30
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,46 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace tests\unit\Magento\FunctionalTestFramework\Console;
79

8-
use AspectMock\Test as AspectMock;
9-
use PHPUnit\Framework\TestCase;
10+
use Exception;
1011
use Magento\FunctionalTestingFramework\Console\BaseGenerateCommand;
11-
use Magento\FunctionalTestingFramework\Suite\Objects\SuiteObject;
1212
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
13-
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
13+
use Magento\FunctionalTestingFramework\Suite\Objects\SuiteObject;
1414
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
15+
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
16+
use PHPUnit\Framework\TestCase;
17+
use ReflectionClass;
18+
use ReflectionException;
19+
use ReflectionProperty;
1520

1621
class BaseGenerateCommandTest extends TestCase
1722
{
18-
public function tearDown(): void
23+
/**
24+
* @inheritDoc
25+
*/
26+
protected function tearDown(): void
1927
{
20-
AspectMock::clean();
28+
$handler = TestObjectHandler::getInstance();
29+
$testsProperty = new ReflectionProperty(TestObjectHandler::class, 'tests');
30+
$testsProperty->setAccessible(true);
31+
$testsProperty->setValue($handler, []);
32+
$testObjectHandlerProperty = new ReflectionProperty(TestObjectHandler::class, 'testObjectHandler');
33+
$testObjectHandlerProperty->setAccessible(true);
34+
$testObjectHandlerProperty->setValue($handler);
35+
36+
$handler = SuiteObjectHandler::getInstance();
37+
$suiteObjectsProperty = new ReflectionProperty(SuiteObjectHandler::class, 'suiteObjects');
38+
$suiteObjectsProperty->setAccessible(true);
39+
$suiteObjectsProperty->setValue($handler, []);
40+
$suiteObjectHandlerProperty = new ReflectionProperty(SuiteObjectHandler::class, 'instance');
41+
$suiteObjectHandlerProperty->setAccessible(true);
42+
$suiteObjectHandlerProperty->setValue($handler);
2143
}
2244

23-
public function testOneTestOneSuiteConfig()
45+
public function testOneTestOneSuiteConfig(): void
2446
{
2547
$testOne = new TestObject('Test1', [], [], []);
2648
$suiteOne = new SuiteObject('Suite1', ['Test1' => $testOne], [], []);
@@ -35,7 +57,7 @@ public function testOneTestOneSuiteConfig()
3557
$this->assertEquals($expected, $actual);
3658
}
3759

38-
public function testOneTestTwoSuitesConfig()
60+
public function testOneTestTwoSuitesConfig(): void
3961
{
4062
$testOne = new TestObject('Test1', [], [], []);
4163
$suiteOne = new SuiteObject('Suite1', ['Test1' => $testOne], [], []);
@@ -51,7 +73,7 @@ public function testOneTestTwoSuitesConfig()
5173
$this->assertEquals($expected, $actual);
5274
}
5375

54-
public function testOneTestOneGroup()
76+
public function testOneTestOneGroup(): void
5577
{
5678
$testOne = new TestObject('Test1', [], ['group' => ['Group1']], []);
5779

@@ -65,7 +87,7 @@ public function testOneTestOneGroup()
6587
$this->assertEquals($expected, $actual);
6688
}
6789

68-
public function testThreeTestsTwoGroup()
90+
public function testThreeTestsTwoGroup(): void
6991
{
7092
$testOne = new TestObject('Test1', [], ['group' => ['Group1']], []);
7193
$testTwo = new TestObject('Test2', [], ['group' => ['Group1']], []);
@@ -81,7 +103,7 @@ public function testThreeTestsTwoGroup()
81103
$this->assertEquals($expected, $actual);
82104
}
83105

84-
public function testOneTestOneSuiteOneGroupConfig()
106+
public function testOneTestOneSuiteOneGroupConfig(): void
85107
{
86108
$testOne = new TestObject('Test1', [], ['group' => ['Group1']], []);
87109
$suiteOne = new SuiteObject('Suite1', ['Test1' => $testOne], [], []);
@@ -96,7 +118,7 @@ public function testOneTestOneSuiteOneGroupConfig()
96118
$this->assertEquals($expected, $actual);
97119
}
98120

99-
public function testTwoTestOneSuiteTwoGroupConfig()
121+
public function testTwoTestOneSuiteTwoGroupConfig(): void
100122
{
101123
$testOne = new TestObject('Test1', [], ['group' => ['Group1']], []);
102124
$testTwo = new TestObject('Test2', [], ['group' => ['Group2']], []);
@@ -112,7 +134,7 @@ public function testTwoTestOneSuiteTwoGroupConfig()
112134
$this->assertEquals($expected, $actual);
113135
}
114136

115-
public function testTwoTestTwoSuiteOneGroupConfig()
137+
public function testTwoTestTwoSuiteOneGroupConfig(): void
116138
{
117139
$testOne = new TestObject('Test1', [], ['group' => ['Group1']], []);
118140
$testTwo = new TestObject('Test2', [], ['group' => ['Group1']], []);
@@ -131,10 +153,12 @@ public function testTwoTestTwoSuiteOneGroupConfig()
131153

132154
/**
133155
* Test specific usecase of a test that is in a group with the group being called along with the suite
134-
* i.e. run:group Group1 Suite1
135-
* @throws \Exception
156+
* i.e. run:group Group1 Suite1.
157+
*
158+
* @return void
159+
* @throws Exception
136160
*/
137-
public function testThreeTestOneSuiteOneGroupMix()
161+
public function testThreeTestOneSuiteOneGroupMix(): void
138162
{
139163
$testOne = new TestObject('Test1', [], [], []);
140164
$testTwo = new TestObject('Test2', [], [], []);
@@ -156,7 +180,7 @@ public function testThreeTestOneSuiteOneGroupMix()
156180
$this->assertEquals($expected, $actual);
157181
}
158182

159-
public function testSuiteToTestSyntax()
183+
public function testSuiteToTestSyntax(): void
160184
{
161185
$testOne = new TestObject('Test1', [], [], []);
162186
$suiteOne = new SuiteObject(
@@ -175,51 +199,82 @@ public function testSuiteToTestSyntax()
175199
}
176200

177201
/**
178-
* Mock handlers to skip parsing
202+
* Mock handlers to skip parsing.
203+
*
179204
* @param array $testArray
180205
* @param array $suiteArray
181-
* @throws \Exception
206+
*
207+
* @return void
208+
* @throws Exception
182209
*/
183-
public function mockHandlers($testArray, $suiteArray)
210+
public function mockHandlers(array $testArray, array $suiteArray): void
184211
{
185-
AspectMock::double(TestObjectHandler::class, ['initTestData' => ''])->make();
212+
// bypass the initTestData method
213+
$testObjectHandlerClass = new ReflectionClass(TestObjectHandler::class);
214+
$constructor = $testObjectHandlerClass->getConstructor();
215+
$constructor->setAccessible(true);
216+
$testObjectHandlerObject = $testObjectHandlerClass->newInstanceWithoutConstructor();
217+
$constructor->invoke($testObjectHandlerObject);
218+
219+
$testObjectHandlerProperty = new ReflectionProperty(TestObjectHandler::class, 'testObjectHandler');
220+
$testObjectHandlerProperty->setAccessible(true);
221+
$testObjectHandlerProperty->setValue($testObjectHandlerObject);
222+
186223
$handler = TestObjectHandler::getInstance();
187-
$property = new \ReflectionProperty(TestObjectHandler::class, 'tests');
224+
$property = new ReflectionProperty(TestObjectHandler::class, 'tests');
188225
$property->setAccessible(true);
189226
$property->setValue($handler, $testArray);
190227

191-
AspectMock::double(SuiteObjectHandler::class, ['initSuiteData' => ''])->make();
228+
// bypass the initTestData method
229+
$suiteObjectHandlerClass = new ReflectionClass(SuiteObjectHandler::class);
230+
$constructor = $suiteObjectHandlerClass->getConstructor();
231+
$constructor->setAccessible(true);
232+
$suiteObjectHandlerObject = $suiteObjectHandlerClass->newInstanceWithoutConstructor();
233+
$constructor->invoke($suiteObjectHandlerObject);
234+
235+
$suiteObjectHandlerProperty = new ReflectionProperty(SuiteObjectHandler::class, 'instance');
236+
$suiteObjectHandlerProperty->setAccessible(true);
237+
$suiteObjectHandlerProperty->setValue($suiteObjectHandlerObject);
238+
192239
$handler = SuiteObjectHandler::getInstance();
193-
$property = new \ReflectionProperty(SuiteObjectHandler::class, 'suiteObjects');
240+
$property = new ReflectionProperty(SuiteObjectHandler::class, 'suiteObjects');
194241
$property->setAccessible(true);
195242
$property->setValue($handler, $suiteArray);
196243
}
197244

198245
/**
199-
* Changes visibility and runs getTestAndSuiteConfiguration
246+
* Changes visibility and runs getTestAndSuiteConfiguration.
247+
*
200248
* @param array $testArray
249+
*
201250
* @return string
251+
* @throws ReflectionException
202252
*/
203-
public function callTestConfig($testArray)
253+
public function callTestConfig(array $testArray): string
204254
{
205255
$command = new BaseGenerateCommand();
206-
$class = new \ReflectionClass($command);
256+
$class = new ReflectionClass($command);
207257
$method = $class->getMethod('getTestAndSuiteConfiguration');
208258
$method->setAccessible(true);
259+
209260
return $method->invokeArgs($command, [$testArray]);
210261
}
211262

212263
/**
213-
* Changes visibility and runs getGroupAndSuiteConfiguration
264+
* Changes visibility and runs getGroupAndSuiteConfiguration.
265+
*
214266
* @param array $groupArray
267+
*
215268
* @return string
269+
* @throws ReflectionException
216270
*/
217-
public function callGroupConfig($groupArray)
271+
public function callGroupConfig(array $groupArray): string
218272
{
219273
$command = new BaseGenerateCommand();
220-
$class = new \ReflectionClass($command);
274+
$class = new ReflectionClass($command);
221275
$method = $class->getMethod('getGroupAndSuiteConfiguration');
222276
$method->setAccessible(true);
277+
223278
return $method->invokeArgs($command, [$groupArray]);
224279
}
225280
}

0 commit comments

Comments
 (0)