Skip to content

Commit 67ca444

Browse files
committed
added stdin testcoverage
1 parent a215a30 commit 67ca444

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎tests/Utils/CLITest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,30 @@ public function tokenizeParams()
205205
],
206206
];
207207
}
208+
209+
/**
210+
* @dataProvider stdinParams
211+
*
212+
* @param string $cmd
213+
* @param int $result
214+
*/
215+
public function testStdinPipe($cmd, $result)
216+
{
217+
exec ($cmd, $out, $ret);
218+
$this->assertSame($result, $ret);
219+
}
220+
221+
public function stdinParams()
222+
{
223+
$binPath = PHP_BINARY .' '. dirname(__DIR__,2 ). '/bin/';
224+
225+
return [
226+
['echo "SELECT 1" | '. $binPath .'highlight-query', 0],
227+
['echo "invalid query" | '. $binPath .'highlight-query', 0],
228+
['echo "SELECT 1" | '. $binPath .'lint-query', 0],
229+
['echo "invalid query" | '. $binPath .'lint-query', 10],
230+
['echo "SELECT 1" | '. $binPath .'tokenize-query', 0],
231+
['echo "invalid query" | '. $binPath .'tokenize-query', 0],
232+
];
233+
}
208234
}

0 commit comments

Comments
 (0)