Skip to content

Commit 727293f

Browse files
Manjusha.SManjusha.S
Manjusha.S
authored and
Manjusha.S
committed
Merge branch 'ACQE-4040' into mftf-release-ver1
2 parents 66eada5 + 97e682d commit 727293f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 16 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,15 @@ 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+
$testDependencyFileLocationDir = dirname($testDependencyFileLocation);
568+
if (!is_dir($testDependencyFileLocationDir)) {
569+
mkdir($testDependencyFileLocationDir, 0777, true);
570+
}
571+
$file = fopen($testDependencyFileLocation, 'w');
559572
$json = json_encode($array, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
560573
fwrite($file, $json);
561574
fclose($file);

0 commit comments

Comments
 (0)