Skip to content

Commit 3895f21

Browse files
committed
MQE-975: Bump MFTF version in Magento and deliver all related changes to new version
- remove explicity exit code in function - fix _bootstrap file
1 parent 3b88afa commit 3895f21

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

dev/tests/acceptance/RoboFile.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ private function parseTestsConfigJson($json, $testConfiguration) {
198198

199199
// stop execution if we have failed to properly parse any json
200200
if (json_last_error() != JSON_ERROR_NONE) {
201-
$this->say("JSON could not be parsed: " . json_last_error_msg());
202-
exit(1);
201+
throw new \Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException("JSON could not be parsed: " . json_last_error_msg());
203202
}
204203

205204
$jsonTestConfiguration['tests'] = $testConfigArray['tests'] ?? null;;

dev/tests/acceptance/tests/_bootstrap.php

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$projectRootPath = $bootstrapRoot;
99

1010
// If we're under a vendor directory, find project root.
11-
if (strpos($bootstrapRoot, '/vendor') != 0) {
11+
if (strpos($bootstrapRoot, '/vendor') !== false) {
1212
$projectRootPath = substr($bootstrapRoot, 0, strpos($bootstrapRoot, '/vendor/'));
1313
}
1414

@@ -28,9 +28,16 @@
2828
// Find framework path
2929
$COMPOSER_FW_FULL_PREFIX = $loader->getPrefixesPsr4()[$FW_PACKAGE_NAME][0] ?? null;
3030
if ($COMPOSER_FW_FULL_PREFIX === null) {
31-
throw new Exception("You must have the magento/magento2-functional-testing-framework installed to be able to generate tests.");
31+
throw new Exception(
32+
"You must have the magento/magento2-functional-testing-framework
33+
installed to be able to generate tests."
34+
);
3235
}
33-
$FW_PATH = substr($COMPOSER_FW_FULL_PREFIX, 0, strpos($COMPOSER_FW_FULL_PREFIX, "/src/Magento/FunctionalTestingFramework"));
36+
$FW_PATH = substr(
37+
$COMPOSER_FW_FULL_PREFIX,
38+
0,
39+
strpos($COMPOSER_FW_FULL_PREFIX, "/src/Magento/FunctionalTestingFramework")
40+
);
3441

3542
// Find tests path
3643
$COMPOSER_TEST_FULL_PREFIX = $loader->getPrefixesPsr4()[$TESTS_PACKAGE_NAME][0] ?? null;
@@ -41,18 +48,23 @@
4148
$TEST_PATH = $COMPOSER_TEST_FULL_PREFIX;
4249
}
4350

44-
// We register "Magento\\" to "tests/functional/Magento" for our own class loading, need to try and find a prefix that isn't that one.
51+
// We register "Magento\\" to "tests/functional/Magento" for our own class loading, need to try and find a
52+
// prefix that isn't that one.
4553
$COMPOSER_MAGENTO_PREFIXES = $loader->getPrefixesPsr4()[$MAGENTO_PACKAGE_NAME];
4654
$COMPOSER_MAGENTO_FULL_PREFIX = null;
4755
foreach ($COMPOSER_MAGENTO_PREFIXES as $path) {
48-
if (strpos($path, "tests/functional/Magento") == 0) {
56+
if (strpos($path, "tests/functional/Magento") === 0) {
4957
$COMPOSER_MAGENTO_FULL_PREFIX = $path;
5058
}
5159
}
5260
if ($COMPOSER_MAGENTO_FULL_PREFIX === null) {
5361
$MAGENTO_PATH = dirname(__DIR__ . "/../../../../../");
5462
} else {
55-
$MAGENTO_PATH = substr($COMPOSER_MAGENTO_FULL_PREFIX, 0, strpos($COMPOSER_MAGENTO_FULL_PREFIX, "/app/code/Magento"));
63+
$MAGENTO_PATH = substr(
64+
$COMPOSER_MAGENTO_FULL_PREFIX,
65+
0,
66+
strpos($COMPOSER_MAGENTO_FULL_PREFIX, "/app/code/Magento")
67+
);
5668
}
5769

5870
$RELATIVE_TESTS_MODULE_PATH = '/Magento/FunctionalTest';
@@ -65,14 +77,19 @@
6577
$env->load();
6678

6779
if (array_key_exists('TESTS_MODULE_PATH', $_ENV) xor array_key_exists('TESTS_BP', $_ENV)) {
68-
throw new Exception('You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter');
80+
throw new Exception(
81+
'You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter'
82+
);
6983
}
7084

7185
foreach ($_ENV as $key => $var) {
7286
defined($key) || define($key, $var);
7387
}
7488

75-
defined('MAGENTO_CLI_COMMAND_PATH') || define('MAGENTO_CLI_COMMAND_PATH', 'dev/tests/acceptance/utils/command.php');
89+
defined('MAGENTO_CLI_COMMAND_PATH') || define(
90+
'MAGENTO_CLI_COMMAND_PATH',
91+
'dev/tests/acceptance/utils/command.php'
92+
);
7693
$env->setEnvironmentVariable('MAGENTO_CLI_COMMAND_PATH', MAGENTO_CLI_COMMAND_PATH);
7794

7895
defined('MAGENTO_CLI_COMMAND_PARAMETER') || define('MAGENTO_CLI_COMMAND_PARAMETER', 'command');
@@ -81,10 +98,13 @@
8198

8299
defined('FW_BP') || define('FW_BP', realpath($FW_PATH));
83100
defined('TESTS_BP') || define('TESTS_BP', realpath($TEST_PATH));
84-
defined('TESTS_MODULE_PATH') || define('TESTS_MODULE_PATH', realpath($TEST_PATH . $RELATIVE_TESTS_MODULE_PATH));
101+
defined('TESTS_MODULE_PATH') || define(
102+
'TESTS_MODULE_PATH',
103+
realpath($TEST_PATH . $RELATIVE_TESTS_MODULE_PATH)
104+
);
85105

86106
// add the debug flag here
87107
$debug_mode = $_ENV['MFTF_DEBUG'] ?? false;
88108
if (!(bool)$debug_mode && extension_loaded('xdebug')) {
89109
xdebug_disable();
90-
}
110+
}

0 commit comments

Comments
 (0)