@@ -76,15 +76,17 @@ public function testComposerInstallAndUpdate() {
7676 $ this ->composer ('drupal-scaffold ' );
7777 $ this ->assertFileExists ($ exampleScaffoldFile , 'Scaffold file should be installed by "drupal-scaffold" command. ' );
7878
79- // We touch a scaffold file, so we can check the file was modified after
80- // the scaffold update.
81- touch ($ exampleScaffoldFile );
82- $ mtime_touched = filemtime ($ exampleScaffoldFile );
83- // Requiring a newer version triggers "composer update"
84- $ this ->composer ('require drupal/core:"8.0.1" ' );
85- clearstatcache ();
86- $ mtime_after = filemtime ($ exampleScaffoldFile );
87- $ this ->assertNotEquals ($ mtime_after , $ mtime_touched , 'Scaffold file was modified by composer update. ' );
79+ foreach (['8.0.1 ' , '8.1.x-dev ' ] as $ version ) {
80+ // We touch a scaffold file, so we can check the file was modified after
81+ // the scaffold update.
82+ touch ($ exampleScaffoldFile );
83+ $ mtime_touched = filemtime ($ exampleScaffoldFile );
84+ // Requiring a newer version triggers "composer update"
85+ $ this ->composer ('require --update-with-dependencies drupal/core:" ' . $ version .'" ' );
86+ clearstatcache ();
87+ $ mtime_after = filemtime ($ exampleScaffoldFile );
88+ $ this ->assertNotEquals ($ mtime_after , $ mtime_touched , 'Scaffold file was modified by composer update. ( ' . $ version . ') ' );
89+ }
8890
8991 // We touch a scaffold file, so we can check the file was modified after
9092 // the custom commandscaffold update.
@@ -149,7 +151,10 @@ protected function composerJSONDefaults() {
149151 */
150152 protected function composer ($ command ) {
151153 chdir ($ this ->tmpDir );
152- passthru (escapeshellcmd ($ this ->rootDir . '/vendor/bin/composer ' . $ command ));
154+ passthru (escapeshellcmd ($ this ->rootDir . '/vendor/bin/composer ' . $ command ), $ exit_code );
155+ if ($ exit_code !== 0 ) {
156+ throw new \Exception ('Composer returned a non-zero exit code ' );
157+ }
153158 }
154159
155160 /**
@@ -160,7 +165,10 @@ protected function composer($command) {
160165 */
161166 protected function git ($ command ) {
162167 chdir ($ this ->rootDir );
163- passthru (escapeshellcmd ('git ' . $ command ));
168+ passthru (escapeshellcmd ('git ' . $ command ), $ exit_code );
169+ if ($ exit_code !== 0 ) {
170+ throw new \Exception ('Git returned a non-zero exit code ' );
171+ }
164172 }
165173
166174 /**
0 commit comments