Skip to content

Commit

Permalink
added stdin testcoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 5, 2019
1 parent a215a30 commit 67ca444
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Utils/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,30 @@ public function tokenizeParams()
],
];
}

/**
* @dataProvider stdinParams
*
* @param string $cmd
* @param int $result
*/
public function testStdinPipe($cmd, $result)
{
exec ($cmd, $out, $ret);
$this->assertSame($result, $ret);
}

public function stdinParams()
{
$binPath = PHP_BINARY .' '. dirname(__DIR__,2 ). '/bin/';

return [
['echo "SELECT 1" | '. $binPath .'highlight-query', 0],
['echo "invalid query" | '. $binPath .'highlight-query', 0],
['echo "SELECT 1" | '. $binPath .'lint-query', 0],
['echo "invalid query" | '. $binPath .'lint-query', 10],
['echo "SELECT 1" | '. $binPath .'tokenize-query', 0],
['echo "invalid query" | '. $binPath .'tokenize-query', 0],
];
}
}

0 comments on commit 67ca444

Please sign in to comment.