@@ -173,7 +173,31 @@ public function testDrupal9() {
173173 }
174174
175175 /**
176- * Writes the default composer json to the temp direcoty.
176+ * Tests that on Drupal 7, core and contrib modules are handled.
177+ */
178+ public function testDrupal7 () {
179+ $ core_version = '7.78.0 ' ;
180+ $ contrib_module = 'views ' ;
181+ $ contrib_composer_version = '3.24.0 ' ;
182+ $ contrib_drupal_version = '7.x-3.24 ' ;
183+ $ translations_directory = $ this ->tmpDir . DIRECTORY_SEPARATOR . 'core ' . DIRECTORY_SEPARATOR . 'translations ' . DIRECTORY_SEPARATOR . 'contrib ' ;
184+ $ core_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . 'drupal- ' . $ core_version . '.fr.po ' ;
185+ $ fr_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . $ contrib_module . '- ' . $ contrib_drupal_version . '.fr.po ' ;
186+
187+ $ this ->assertFileNotExists ($ core_translation_file , 'French translations file should not exist. ' );
188+ $ this ->assertFileNotExists ($ fr_translation_file , 'French translations file should not exist. ' );
189+ $ this ->composer ('install ' );
190+ $ this ->composer ('remove drupal/core ' );
191+ // Set Drupal repository to target Drupal 7.
192+ $ this ->composer ('config repositories.drupal composer https://packages.drupal.org/7 ' );
193+ $ this ->composer ('require drupal/drupal:" ' . $ core_version . '" ' );
194+ $ this ->composer ('require drupal/ ' . $ contrib_module . ':" ' . $ contrib_composer_version . '" ' );
195+ $ this ->assertFileExists ($ core_translation_file , 'French translations file should exist. ' );
196+ $ this ->assertFileExists ($ fr_translation_file , 'French translations file should exist. ' );
197+ }
198+
199+ /**
200+ * Writes the default composer json to the temp directory.
177201 */
178202 protected function writeComposerJson () {
179203 $ json = json_encode ($ this ->composerJsonDefaults (), JSON_PRETTY_PRINT );
@@ -201,11 +225,11 @@ protected function writeTestReleaseTag() {
201225 protected function composerJsonDefaults () {
202226 return [
203227 'repositories ' => [
204- [
228+ ' this_package ' => [
205229 'type ' => 'vcs ' ,
206230 'url ' => $ this ->rootDir ,
207231 ],
208- [
232+ ' drupal ' => [
209233 'type ' => 'composer ' ,
210234 'url ' => 'https://packages.drupal.org/8 ' ,
211235 ],
0 commit comments