public function run() { $i = new ChannelInputStream('input'); $o = new ChannelOutputStream('stdout'); while ($i->available()) { $o->write($i->read()); } }
public function input() { $r = ChannelWrapper::capture(newinstance(Runnable::class, [], ['run' => function () { $i = new ChannelInputStream('input'); $o = new ChannelOutputStream('stdout'); while ($i->available()) { $o->write($i->read()); } }]), ['input' => '+OK Piped input']); $this->assertEquals('+OK Piped input', $r['stdout']); }