@@ -37,7 +37,8 @@ class GenerateTestsCommand extends BaseGenerateCommand
37
37
const PARALLEL_DEFAULT_TIME = 10 ;
38
38
const EXTENDS_REGEX_PATTERN = '/extends=[" \']([^ \'"]*)/ ' ;
39
39
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 ' ;
41
42
42
43
/**
43
44
* @var ScriptUtil
@@ -250,8 +251,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
250
251
if (!empty ($ log )) {
251
252
if ($ log === "testEntityJson " ) {
252
253
$ 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
+ }
253
258
$ output ->writeln (
254
- "Test dependencies file created, Located in: " . self :: TEST_DEPENDENCY_FILE_LOCATION
259
+ "Test dependencies file created, Located in: " . $ testDependencyFileLocation
255
260
);
256
261
} else {
257
262
$ output ->writeln (
@@ -555,7 +560,15 @@ private function getExtendedTestDependencies(array $extendedTests): array
555
560
*/
556
561
private function array2Json (array $ array )
557
562
{
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 ' );
559
572
$ json = json_encode ($ array , JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT );
560
573
fwrite ($ file , $ json );
561
574
fclose ($ file );
0 commit comments