From db78bbbce24b100ca6774e6152c0d726fa782bc5 Mon Sep 17 00:00:00 2001 From: Florent Torregrosa Date: Fri, 20 Mar 2020 18:38:55 +0100 Subject: [PATCH] Add test for the behavior when using composer install with an existing composer.lock. --- tests/PluginTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/PluginTest.php b/tests/PluginTest.php index 7014fea..d39ee25 100644 --- a/tests/PluginTest.php +++ b/tests/PluginTest.php @@ -68,6 +68,7 @@ public function tearDown() { public function testComposerInstallAndUpdate() { $version = '8.3.0'; $translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib'; + $core_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'core'; $fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.fr.po'; $es_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.es.po'; @@ -84,6 +85,13 @@ public function testComposerInstallAndUpdate() { $this->composer('drupal:l10n'); $this->assertFileExists($fr_translation_file, 'French translations file was downloaded by custom command.'); + // We remove a downloaded file and a package, so we can check the file was + // downloaded after the command install has been executed. + $this->fs->remove($fr_translation_file); + $this->fs->removeDirectory($core_directory); + $this->composer('install'); + $this->assertFileExists($fr_translation_file, 'French translations file should exist.'); + // Test downloading a new version of the translations. $version = '8.3.1'; $fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.fr.po';