Skip to content

Commit 1198b27

Browse files
author
Global
committed
ACQE-4040 | Make dynamic path for dependency file for standalone and embedded mftf
1 parent a628e57 commit 1198b27

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class GenerateTestsCommand extends BaseGenerateCommand
3737
const PARALLEL_DEFAULT_TIME = 10;
3838
const EXTENDS_REGEX_PATTERN = '/extends=["\']([^\'"]*)/';
3939
const ACTIONGROUP_REGEX_PATTERN = '/ref=["\']([^\'"]*)/';
40-
const TEST_DEPENDENCY_FILE_LOCATION = 'dev/tests/_output/test-dependencies.json';
40+
const TEST_DEPENDENCY_FILE_LOCATION_STANDALONE = 'dev/tests/_output/test-dependencies.json';
41+
const TEST_DEPENDENCY_FILE_LOCATION_EMBEDDED = 'dev/tests/acceptance/tests/_output/test-dependencies.json';
4142

4243
/**
4344
* @var ScriptUtil
@@ -250,8 +251,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
250251
if (!empty($log)) {
251252
if ($log === "testEntityJson") {
252253
$this->getTestEntityJson($tests);
254+
$testDependencyFileLocation = self::TEST_DEPENDENCY_FILE_LOCATION_EMBEDDED;
255+
if (isset($_ENV['MAGENTO_BP'])) {
256+
$testDependencyFileLocation = self::TEST_DEPENDENCY_FILE_LOCATION_STANDALONE;
257+
}
253258
$output->writeln(
254-
"Test dependencies file created, Located in: " . self::TEST_DEPENDENCY_FILE_LOCATION
259+
"Test dependencies file created, Located in: " . $testDependencyFileLocation
255260
);
256261
} else {
257262
$output->writeln(
@@ -555,7 +560,11 @@ private function getExtendedTestDependencies(array $extendedTests): array
555560
*/
556561
private function array2Json(array $array)
557562
{
558-
$file = fopen(self::TEST_DEPENDENCY_FILE_LOCATION, 'w');
563+
$testDependencyFileLocation = self::TEST_DEPENDENCY_FILE_LOCATION_EMBEDDED;
564+
if (isset($_ENV['MAGENTO_BP'])) {
565+
$testDependencyFileLocation = self::TEST_DEPENDENCY_FILE_LOCATION_STANDALONE;
566+
}
567+
$file = fopen($testDependencyFileLocation, 'w');
559568
$json = json_encode($array, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
560569
fwrite($file, $json);
561570
fclose($file);

0 commit comments

Comments
 (0)