Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test composer install with lock file #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace DrupalComposer\DrupalScaffold\Tests;

use Composer\Util\Filesystem;
use Symfony\Component\Finder\Finder;

/**
* Tests composer plugin functionality.
Expand Down Expand Up @@ -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.
*/
Expand Down