@@ -41,7 +41,7 @@ class PluginTest extends TestCase {
4141 /**
4242 * SetUp test.
4343 */
44- public function setUp () {
44+ public function setUp () : void {
4545 $ this ->rootDir = realpath (realpath (__DIR__ . '/.. ' ));
4646
4747 // Prepare temp directory.
@@ -58,7 +58,7 @@ public function setUp() {
5858 /**
5959 * Method tearDown.
6060 */
61- public function tearDown () {
61+ public function tearDown () : void {
6262 $ this ->fs ->removeDirectory ($ this ->tmpDir );
6363 $ this ->git (sprintf ('tag -d "%s" ' , $ this ->tmpReleaseTag ));
6464 }
@@ -143,6 +143,35 @@ public function testContribmodules() {
143143 $ this ->assertFileExists ($ fr_translation_file , "French translations file for version: $ contrib_drupal_version should exist. " );
144144 }
145145
146+ /**
147+ * Tests that on Drupal 9, core and contrib modules are handled.
148+ *
149+ * Either if using semver or not.
150+ */
151+ public function testDrupal9 () {
152+ $ core_version = '9.1.3 ' ;
153+ $ contrib_module = 'entity_share ' ;
154+ $ contrib_composer_version = '3.0.0-beta2 ' ;
155+ $ contrib_drupal_version = '8.x-3.0-beta2 ' ;
156+ $ semver_contrib_module = 'entity_share_cron ' ;
157+ $ semver_contrib_composer_version = '3.0.0-beta1 ' ;
158+ $ semver_contrib_drupal_version = '3.0.0-beta1 ' ;
159+ $ translations_directory = $ this ->tmpDir . DIRECTORY_SEPARATOR . 'translations ' . DIRECTORY_SEPARATOR . 'contrib ' ;
160+ $ core_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . 'drupal- ' . $ core_version . '.fr.po ' ;
161+ $ fr_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . $ contrib_module . '- ' . $ contrib_drupal_version . '.fr.po ' ;
162+ $ semver_fr_translation_file = $ translations_directory . DIRECTORY_SEPARATOR . $ semver_contrib_module . '- ' . $ semver_contrib_drupal_version . '.fr.po ' ;
163+
164+ $ this ->assertFileNotExists ($ core_translation_file , 'French translations file should not exist. ' );
165+ $ this ->assertFileNotExists ($ fr_translation_file , 'French translations file should not exist. ' );
166+ $ this ->assertFileNotExists ($ semver_fr_translation_file , 'French translations file should not exist. ' );
167+ $ this ->composer ('install ' );
168+ $ this ->composer ('require --update-with-dependencies drupal/core:" ' . $ core_version . '" ' );
169+ $ this ->composer ('require drupal/ ' . $ contrib_module . ':" ' . $ contrib_composer_version . '" drupal/ ' . $ semver_contrib_module . ':" ' . $ semver_contrib_composer_version . '" ' );
170+ $ this ->assertFileExists ($ core_translation_file , 'French translations file should exist. ' );
171+ $ this ->assertFileExists ($ fr_translation_file , 'French translations file should exist. ' );
172+ $ this ->assertFileExists ($ semver_fr_translation_file , 'French translations file should exist. ' );
173+ }
174+
146175 /**
147176 * Writes the default composer json to the temp direcoty.
148177 */
0 commit comments