Differential D20988 Diff 50015 src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
| Show All 37 Lines | try { | ||||
| } | } | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| $caught = $ex; | $caught = $ex; | ||||
| } | } | ||||
| $this->assertTrue($caught instanceof CommandException); | $this->assertTrue($caught instanceof CommandException); | ||||
| } | } | ||||
| private function writeAndRead($write, $read) { | private function writeAndRead($write, $read) { | ||||
| $future = new ExecFuture('cat'); | $bin = $this->getSupportExecutable('cat'); | ||||
| $future = new ExecFuture('php -f %R', $bin); | |||||
| $future->write($write); | $future->write($write); | ||||
| $lines = array(); | $lines = array(); | ||||
| foreach (new LinesOfALargeExecFuture($future) as $line) { | foreach (new LinesOfALargeExecFuture($future) as $line) { | ||||
| $lines[] = $line; | $lines[] = $line; | ||||
| } | } | ||||
| $this->assertEqual( | $this->assertEqual( | ||||
| $read, | $read, | ||||
| $lines, | $lines, | ||||
| pht('Write: %s', id(new PhutilUTF8StringTruncator()) | pht('Write: %s', id(new PhutilUTF8StringTruncator()) | ||||
| ->setMaximumGlyphs(32) | ->setMaximumGlyphs(32) | ||||
| ->truncateString($write))); | ->truncateString($write))); | ||||
| } | } | ||||
| } | } | ||||