@@ -101,6 +101,7 @@ protected function initializeComposer(string $path): string
101101 'init ' ,
102102 '--name=grumphp/testsuite ' .$ this ->hash ,
103103 '--type=library ' ,
104+ '--author=GrumPHP Test Suite ' ,
104105 '--require-dev=phpro/grumphp: ' .$ this ->detectCurrentGrumphpGitBranchForComposerWithFallback (),
105106 '--require-dev=phpunit/phpunit:* ' ,
106107 '--repository= ' .json_encode ([
@@ -115,10 +116,17 @@ protected function initializeComposer(string $path): string
115116 $ path
116117 );
117118
118- $ this ->runCommand ('initialize composer ' , $ process );
119-
120119 $ composerFile = $ path .$ this ->useCorrectDirectorySeparator ('/composer.json ' );
121120
121+ try {
122+ $ this ->runCommand ('initialize composer ' , $ process );
123+ } catch (\Exception $ e ) {
124+ throw new Exception ('Could not initialize composer in ' .$ composerFile .'! ' . PHP_EOL . PHP_EOL . file_get_contents ($ composerFile ), 0 , $ e );
125+ }
126+
127+ echo file_get_contents ($ composerFile );
128+
129+
122130 $ this ->mergeComposerConfig ($ composerFile , [
123131 'autoload ' => [
124132 'psr-4 ' => [
@@ -132,6 +140,8 @@ protected function initializeComposer(string $path): string
132140 ],
133141 ]);
134142
143+ echo file_get_contents ($ composerFile );
144+
135145 return $ composerFile ;
136146 }
137147
@@ -172,7 +182,7 @@ protected function mergeComposerConfig(string $composerFile, array $config, $rec
172182 $ this ->assertFileExists ($ composerFile );
173183 $ source = json_decode (file_get_contents ($ composerFile ), true );
174184 $ newSource = $ recursive ? array_merge_recursive ($ source , $ config ) : array_merge ($ source , $ config );
175- $ flags = JSON_FORCE_OBJECT + JSON_PRETTY_PRINT +JSON_UNESCAPED_SLASHES ;
185+ $ flags = JSON_PRETTY_PRINT +JSON_UNESCAPED_SLASHES ;
176186 $ this ->dumpFile ($ composerFile , json_encode ($ newSource , $ flags ));
177187 }
178188
@@ -373,7 +383,13 @@ protected function installComposer(string $path, array $arguments = [])
373383 $ path
374384 );
375385
376- $ this ->runCommand ('install composer ' , $ process );
386+ $ composerFile = $ path .$ this ->useCorrectDirectorySeparator ('/composer.json ' );
387+ try {
388+ $ this ->runCommand ('install composer ' , $ process );
389+ } catch (\Exception $ e ) {
390+ throw new \Exception ('Could not initialize composer in ' .$ composerFile .'! ' . PHP_EOL . PHP_EOL . file_get_contents ($ composerFile ), 0 , $ e );
391+ }
392+
377393 }
378394
379395 protected function commitAll (?string $ gitPath = null )
0 commit comments