Skip to content

Commit

Permalink
Merge pull request #222 from civicrm/master-sql
Browse files Browse the repository at this point in the history
cv sql - Fix recent regression. Add sniff test.
  • Loading branch information
totten authored Sep 28, 2024
2 parents 7e7b22b + c8d80a5 commit 7f295ea
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 7f295ea

Please sign in to comment.