From cfdc2a4f455430fd2f74f8d27bc45d702995fd7d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 25 Nov 2013 11:51:21 +0100 Subject: [PATCH] add IO test --- tests/lib/atick/IO/IOTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/lib/atick/IO/IOTest.php 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()); + } +} -- 2.30.2