File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -205,4 +205,30 @@ public function tokenizeParams()
205
205
],
206
206
];
207
207
}
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
+ }
208
234
}
You can’t perform that action at this time.
0 commit comments