From 1ce6c3041b927a2d728100162fe5c6c0b7f90a3b Mon Sep 17 00:00:00 2001 From: nlisgo Date: Tue, 12 Jul 2016 23:42:42 +0100 Subject: [PATCH] Test composer install with lock file --- tests/PluginTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/PluginTest.php b/tests/PluginTest.php index 7046491..87f43aa 100644 --- a/tests/PluginTest.php +++ b/tests/PluginTest.php @@ -8,6 +8,7 @@ namespace DrupalComposer\DrupalScaffold\Tests; use Composer\Util\Filesystem; +use Symfony\Component\Finder\Finder; /** * Tests composer plugin functionality. @@ -99,6 +100,24 @@ public function testComposerInstallAndUpdate() { $this->assertNotEquals($mtime_after, $mtime_touched, 'Scaffold file was modified by custom command.'); } + /** + * Tests a simple composer install with composer.lock in place + */ + public function testComposerInstallWithLock() { + // Prepare composer.lock file + $exampleScaffoldFile = $this->tmpDir . DIRECTORY_SEPARATOR . 'index.php'; + $this->composer('install'); + $finder = new Finder(); + $finder->depth('== 0')->ignoreDotFiles(FALSE)->notName('/^composer\.(lock|json)$/')->in($this->tmpDir); + foreach ($finder as $file) { + $this->fs->remove($file->getRealPath()); + } + $this->assertFileNotExists($exampleScaffoldFile, 'Scaffold file should not be exist.'); + $this->composer('install'); + $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . 'core', 'Drupal core is installed.'); + $this->assertFileExists($exampleScaffoldFile, 'Scaffold file should be automatically installed.'); + } + /** * Writes the default composer json to the temp direcoty. */