Skip to content

Commit db74083

Browse files
Issue #35: Drupal 10 compatibility.
1 parent 40f6fef commit db74083

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/FileFetcher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ public function __construct(IOInterface $io, HttpDownloader $http_downloader, ar
7272
$this->io = $io;
7373
$this->httpDownloader = $http_downloader;
7474
$this->options = $options;
75-
$this->coreMajorVersion = substr($core_version, 0, 1);
7675
$this->fs = new Filesystem();
7776
$this->progress = $progress;
77+
$parsed_core_version = \explode('.', $core_version);
78+
$this->coreMajorVersion = array_shift($parsed_core_version);
7879
}
7980

8081
/**

tests/PluginTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,27 @@ public function testDrupal7() {
167167
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
168168
}
169169

170+
/**
171+
* Tests that on Drupal 10, core and contrib modules are handled.
172+
*/
173+
public function testDrupal10() {
174+
$core_version = '10.0.3';
175+
$contrib_module = 'speedboxes';
176+
$contrib_composer_version = '1.3.0';
177+
$contrib_drupal_version = '8.x-1.3';
178+
$translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib';
179+
$core_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $core_version . '.fr.po';
180+
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';
181+
182+
$this->assertFileDoesNotExist($core_translation_file, 'French translations file should not exist.');
183+
$this->assertFileDoesNotExist($fr_translation_file, 'French translations file should not exist.');
184+
$this->composer('install');
185+
$this->composer('require --update-with-dependencies drupal/core:"' . $core_version . '"');
186+
$this->composer('require drupal/' . $contrib_module . ':"' . $contrib_composer_version . '"');
187+
$this->assertFileExists($core_translation_file, 'French translations file should exist.');
188+
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
189+
}
190+
170191
/**
171192
* Writes the default composer json to the temp directory.
172193
*/

0 commit comments

Comments
 (0)