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. */