6 * Assure that context API behaves as designed. Mostly implicitly tested, but we
7 * do have some edges that need explicit testing.
9 * @see drush/includes/context.inc.
13 class commandSpecificCase extends CommandUnishTestCase {
16 * Try to write a tiny drushrc.php to each place that drush checks. Also
17 * write a sites/dev/aliases.drushrc.php file to the sandbox.
22 $path = UNISH_SANDBOX . '/aliases.drushrc.php';
23 $aliases['site1'] = array(
24 'root' => UNISH_SANDBOX,
26 'source-command-specific' => array(
27 'core-rsync' => array(
28 'exclude-paths' => 'excluded_by_source',
31 'target-command-specific' => array(
32 'core-rsync' => array(
33 'exclude-paths' => 'excluded_by_target',
36 'path-aliases' => array(
37 '%files' => 'sites/default/files',
40 $contents = $this->unish_file_aliases($aliases);
41 $return = file_put_contents($path, $contents);
44 function testCommandSpecific() {
46 'alias-path' => UNISH_SANDBOX,
48 'include-vcs' => NULL,
50 $this->drush('core-rsync', array('/tmp', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
51 $output = trim($this->getOutput());
52 $this->assertContains('excluded_by_target', $output);
53 $this->drush('core-rsync', array('@site1', '/tmp'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
54 $output = trim($this->getOutput());
55 $this->assertContains('excluded_by_source', $output);
56 $this->drush('core-rsync', array('@site1', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
57 $output = trim($this->getOutput());
58 $this->assertContains('excluded_by_target', $output);
59 // Now do that all again with 'exclude-files'
60 $options['exclude-files'] = NULL;
61 $this->drush('core-rsync', array('/tmp', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
62 $output = trim($this->getOutput());
63 $this->assertContains('sites/default/files', $output);
64 $this->assertContains('excluded_by_target', $output);
65 $this->assertNotContains('include-vcs', $output);
66 $this->assertNotContains('exclude-paths', $output);
67 $this->assertNotContains('exclude-files-processed', $output);
68 $this->drush('core-rsync', array('@site1', '/tmp'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
69 $output = trim($this->getOutput());
70 $this->assertContains('sites/default/files', $output);
71 // This one does not work. @see drush_sitealias_evaluate_path
72 // $this->assertContains('excluded_by_source', $output);
73 $this->assertNotContains('include-vcs', $output);
74 $this->assertNotContains('exclude-paths', $output);
75 $this->assertNotContains('exclude-files-processed', $output);
76 $this->drush('core-rsync', array('@site1', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
77 $output = trim($this->getOutput());
78 $this->assertContains('sites/default/files', $output);
79 $this->assertContains('excluded_by_target', $output);
80 $this->assertNotContains('include-vcs', $output);
81 $this->assertNotContains('exclude-paths', $output);
82 $this->assertNotContains('exclude-files-processed', $output);