summaryrefslogtreecommitdiffstats
path: root/tests/Utils/CLITest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Utils/CLITest.php')
-rw-r--r--tests/Utils/CLITest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php
index bacf5fb..d9eadae 100644
--- a/tests/Utils/CLITest.php
+++ b/tests/Utils/CLITest.php
@@ -205,4 +205,30 @@ class CLITest extends TestCase
],
];
}
+
+ /**
+ * @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],
+ ];
+ }
}