예제 #1
0
 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']);
 }
예제 #2
0
 public function input()
 {
     $r = ChannelWrapper::capture(new class implements Runnable
     {
         public function run()
         {
             $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']);
 }
 public function input()
 {
     $r = ChannelWrapper::capture(newinstance('lang.Runnable', array(), '{
   public function run() {
     $i= new ChannelInputStream("input");
     $o= new ChannelOutputStream("stdout");
     while ($i->available()) {
       $o->write($i->read());
     }
   }
 }'), array('input' => '+OK Piped input'));
     $this->assertEquals('+OK Piped input', $r['stdout']);
 }