Skip to content

Commit

Permalink
cv sql - Fix recent regression. Add sniff test.
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Sep 28, 2024
1 parent 7e7b22b commit c8d80a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Command/SqlCliCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
if ($input->getOption('dry-run') && $output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
parent::initialize($input, $output);
}

protected function execute(InputInterface $input, OutputInterface $output): int {
Expand Down
21 changes: 21 additions & 0 deletions tests/Command/SqlCliCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\Process;

/**
* @group std
*/
class SqlCliCommandTest extends \Civi\Cv\CivilTestCase {

public function setUp(): void {
parent::setUp();
}

public function testSqlPipe() {
$query = 'select id, display_name from civicrm_contact limit 1;';
$p = Process::runOk($this->cv("sql")->setInput($query));
$this->assertMatchesRegularExpression('/id\s+display_name/', $p->getOutput());
}

}

0 comments on commit c8d80a5

Please sign in to comment.