1010use Magento \Framework \App \ResourceConnection ;
1111use Magento \Framework \Setup \Mvc \MvcApplication ;
1212use Magento \Framework \Setup \Mvc \ServiceManagerFactory ;
13- use Magento \Framework \Shell ;
14- use Magento \Framework \Shell \CommandRenderer ;
13+
1514use Magento \TestFramework \Deploy \CliCommand ;
1615use Magento \TestFramework \Deploy \TestModuleManager ;
1716use Magento \TestFramework \Helper \Bootstrap ;
@@ -37,18 +36,15 @@ class SetupInstallMvcTest extends SetupTestCase
3736 */
3837 private $ resourceConnection ;
3938
40- /**
41- * @var Shell
42- */
43- private $ shell ;
39+
4440
4541 protected function setUp (): void
4642 {
4743 $ objectManager = Bootstrap::getObjectManager ();
4844 $ this ->moduleManager = $ objectManager ->get (TestModuleManager::class);
4945 $ this ->cliCommand = $ objectManager ->get (CliCommand::class);
5046 $ this ->resourceConnection = $ objectManager ->get (ResourceConnection::class);
51- $ this -> shell = new Shell ( new CommandRenderer ());
47+
5248 }
5349
5450 /**
@@ -283,12 +279,6 @@ public function testSetupInstallWithDataPatchesAndCustomMvc()
283279 'patch_list table should exist after installation with data patches '
284280 );
285281
286- // Check for patch records (may or may not exist depending on module)
287- $ select = $ connection ->select ()
288- ->from ($ patchListTable )
289- ->where ('patch_name LIKE ? ' , '%TestSetupDeclarationModule1% ' );
290- $ patchRecords = $ connection ->fetchAll ($ select );
291-
292282 // Data patches are optional, so we just verify the table exists
293283 $ this ->assertTrue (
294284 $ connection ->isTableExists ($ patchListTable ),
@@ -1032,7 +1022,15 @@ private function executeDiCompileCommand($params = [])
10321022 }
10331023
10341024 try {
1035- return $ this ->shell ->execute ($ diCompileCommand );
1025+ $ output = [];
1026+ $ returnCode = 0 ;
1027+ exec ($ diCompileCommand . ' 2>&1 ' , $ output , $ returnCode );
1028+
1029+ if ($ returnCode !== 0 ) {
1030+ throw new \Exception (implode ("\n" , $ output ));
1031+ }
1032+
1033+ return implode ("\n" , $ output );
10361034 } catch (\Exception $ e ) {
10371035 // Check if this is the "modules are not enabled" error
10381036 $ errorMessage = $ e ->getMessage ();
0 commit comments