Skip to content

Commit

Permalink
Issue #35: Drupal 10 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentTorregrosa committed Mar 19, 2023
1 parent 40f6fef commit db74083
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/FileFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public function __construct(IOInterface $io, HttpDownloader $http_downloader, ar
$this->io = $io;
$this->httpDownloader = $http_downloader;
$this->options = $options;
$this->coreMajorVersion = substr($core_version, 0, 1);
$this->fs = new Filesystem();
$this->progress = $progress;
$parsed_core_version = \explode('.', $core_version);
$this->coreMajorVersion = array_shift($parsed_core_version);
}

/**
Expand Down
21 changes: 21 additions & 0 deletions tests/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ public function testDrupal7() {
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
}

/**
* Tests that on Drupal 10, core and contrib modules are handled.
*/
public function testDrupal10() {
$core_version = '10.0.3';
$contrib_module = 'speedboxes';
$contrib_composer_version = '1.3.0';
$contrib_drupal_version = '8.x-1.3';
$translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib';
$core_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $core_version . '.fr.po';
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';

$this->assertFileDoesNotExist($core_translation_file, 'French translations file should not exist.');
$this->assertFileDoesNotExist($fr_translation_file, 'French translations file should not exist.');
$this->composer('install');
$this->composer('require --update-with-dependencies drupal/core:"' . $core_version . '"');
$this->composer('require drupal/' . $contrib_module . ':"' . $contrib_composer_version . '"');
$this->assertFileExists($core_translation_file, 'French translations file should exist.');
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
}

/**
* Writes the default composer json to the temp directory.
*/
Expand Down

0 comments on commit db74083

Please sign in to comment.