10 class lockMakefileCase extends CommandUnishTestCase {
12 * Path to test make files.
14 protected $makefile_path;
17 * Initialize $makefile_path.
19 function __construct() {
20 $this->makefile_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'makefiles';
24 * Run a given makefile test.
27 * The test makefile to run, as defined by $this->getMakefile();
29 private function runLockfileTest($test) {
30 $default_options = array(
31 'result-file' => UNISH_SANDBOX . '/test.lock.yml',
33 $config = $this->getLockfile($test);
34 $options = array_merge($config['options'], $default_options);
35 $makefile = $this->makefile_path . DIRECTORY_SEPARATOR . $config['makefile'];
36 $lockfile = $this->makefile_path . DIRECTORY_SEPARATOR . 'lockfiles' . DIRECTORY_SEPARATOR . $config['lockfile'];
37 $this->drush('make-lock', array($makefile), $options);
38 $expected = trim(file_get_contents($lockfile));
39 $actual = trim(file_get_contents($options['result-file']));
41 $this->assertEquals($expected, $actual);
44 function getLockfile($key) {
46 $tests = $this->listLockfileTests();
50 function listLockfileTests() {
54 'makefile' => 'lock-default.make.yml',
55 'lockfile' => 'default.lock.yml',
60 'makefile' => 'lock-git.make.yml',
61 'lockfile' => 'git.lock.yml',
68 /************************************************************************
70 * List of lock tests (in alphabetical order, for easier navigation.) *
72 ************************************************************************/
75 * Test locking basic version data.
77 function testDefaultLock() {
78 $this->runLockfileTest('default');
82 * Test locking git version data.
84 function testGitLock() {
85 $this->runLockfileTest('git');