@@ -143,6 +143,34 @@ public function testContribmodules() {
143143 $ this ->assertFileExists ($ semver_fr_translation_file , 'French translations file should exist. ' );
144144 }
145145
146+ /**
147+ * Tests that core-only option skips contrib translations.
148+ */
149+ public function testCoreOnlyOption () {
150+ $ core_version = '9.5.3 ' ;
151+ $ contrib_module = 'entity_share ' ;
152+ $ contrib_composer_version = '3.0.0-rc4 ' ;
153+ $ contrib_drupal_version = '8.x-3.0-rc4 ' ;
154+ $ translations_directory = $ this ->tmpDir . DIRECTORY_SEPARATOR . 'translations ' . DIRECTORY_SEPARATOR . 'contrib ' ;
155+ $ core_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . 'drupal- ' . $ core_version . '.fr.po ' ;
156+ $ contrib_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . $ contrib_module . '- ' . $ contrib_drupal_version . '.fr.po ' ;
157+
158+ $ this ->composer ('install ' );
159+ $ this ->composer ('require --update-with-dependencies drupal/core:" ' . $ core_version . '" ' );
160+ $ this ->composer ('require drupal/ ' . $ contrib_module . ':" ' . $ contrib_composer_version . '" ' );
161+ $ this ->assertFileExists ($ core_translation_file , 'Drupal core translation should exist after install. ' );
162+ $ this ->assertFileExists ($ contrib_translation_file , 'Contrib translation should exist after install. ' );
163+
164+ $ this ->fs ->remove ($ core_translation_file );
165+ $ this ->fs ->remove ($ contrib_translation_file );
166+ $ this ->assertFileDoesNotExist ($ core_translation_file , 'Drupal core translation should not exist after removal. ' );
167+ $ this ->assertFileDoesNotExist ($ contrib_translation_file , 'Contrib translation should not exist after removal. ' );
168+
169+ $ this ->composer ('drupal:l10n --core-only ' );
170+ $ this ->assertFileExists ($ core_translation_file , 'Drupal core translation should exist after --core-only command. ' );
171+ $ this ->assertFileDoesNotExist ($ contrib_translation_file , 'Contrib translation should not exist after --core-only command. ' );
172+ }
173+
146174 /**
147175 * Tests that on Drupal 7, core and contrib modules are handled.
148176 */
0 commit comments