@@ -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