Skip to content

Commit

Permalink
Simplify --dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
jigarius committed Dec 29, 2024
1 parent c50321c commit 887882c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
3 changes: 1 addition & 2 deletions src/Command/ExecCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('dry-run')) {
foreach ($values as $value) {
$pCommand = Placeholder::replace([$placeholder->value => $value], $command);
$output->writeln("$value: Preview");
$output->writeln($pCommand, OutputInterface::VERBOSITY_QUIET);
$output->writeln($pCommand);
}

return Command::SUCCESS;
Expand Down
29 changes: 0 additions & 29 deletions test/Integration/Command/ExecCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,15 +543,10 @@ public function testWithDryRun(): void {
);
$process1->run();
$this->assertOutputEquals(<<<EOF
• default: Preview
./vendor/bin/drush --uri=default st
• donnie: Preview
./vendor/bin/drush --uri=donnie st
• leo: Preview
./vendor/bin/drush --uri=leo st
• mikey: Preview
./vendor/bin/drush --uri=mikey st
• ralph: Preview
./vendor/bin/drush --uri=ralph st
EOF, $process1->getOutput());
Expand All @@ -563,39 +558,15 @@ public function testWithDryRun(): void {
);
$process2->run();
$this->assertOutputEquals(<<<EOF
• default: Preview
./vendor/bin/drush --uri=default st
• donnie: Preview
./vendor/bin/drush --uri=donnie st
• leo: Preview
./vendor/bin/drush --uri=leo st
• mikey: Preview
./vendor/bin/drush --uri=mikey st
• ralph: Preview
./vendor/bin/drush --uri=ralph st
EOF, $process2->getOutput());
}

/**
* @testdox With --dry-run --quiet.
*/
public function testWithDryRunQuiet(): void {
$process = Process::fromShellCommandline(
'drall exec --no-progress --dry-run --quiet -- ./vendor/bin/drush st',
static::PATH_DRUPAL,
);
$process->run();
$this->assertOutputEquals(<<<EOF
./vendor/bin/drush --uri=default st
./vendor/bin/drush --uri=donnie st
./vendor/bin/drush --uri=leo st
./vendor/bin/drush --uri=mikey st
./vendor/bin/drush --uri=ralph st
EOF, $process->getOutput());
}

/**
* @testdox Shows error when --interval is negative.
*/
Expand Down

0 comments on commit 887882c

Please sign in to comment.