From: Michael Wallner Date: Mon, 25 Nov 2013 10:51:21 +0000 (+0100) Subject: add IO test X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=HEAD;p=m6w6%2Fatick add IO test --- diff --git a/tests/lib/atick/IO/IOTest.php b/tests/lib/atick/IO/IOTest.php new file mode 100644 index 0000000..f95f2ea --- /dev/null +++ b/tests/lib/atick/IO/IOTest.php @@ -0,0 +1,31 @@ +ticker = new Ticker; + } + + function testIO() { + $gzip = new IO\Process("gzip -1"); + $base = new IO\Process("base64"); + $func = new IO\Filter(function($f, $data, $eof) { + return strrev($data); + }); + + fwrite($gzip->getInput(), "Hello World!\n"); + fclose($gzip->getInput()); + + $ticker = new Ticker; + $ticker->pipe($gzip, $base, $func, "fpassthru"); + + ob_start(); + while($ticker(1)); + $this->assertStringMatchesFormat("\nAAAAN0HFd3NACQeUJp8LPjwVJnczIN/AEI%sAIs4H", ob_get_contents()); + } +}