Exemple #1
0
 private function t($plain)
 {
     $this->transport->send($plain);
     fseek($this->fd, 0);
     $this->assertEquals($plain, $this->transport->recv());
     fseek($this->fd, 0);
 }
 public function testBufferedTransport()
 {
     //testdaten generieren
     $fd = fopen('php://memory', 'w+');
     $fdt = new FDTransport($fd, $fd);
     $data = ['a', str_repeat('b', 20), str_repeat('c', 200), str_repeat('d', 2000), str_repeat('e', 20000)];
     foreach ($data as $d) {
         $fdt->send($d);
     }
     fseek($fd, 0);
     $chunk = stream_get_contents($fd);
     // gegentest auf die testdaten
     $obj = new TestBufferTransport();
     $obj->setChunk($chunk);
     foreach ($data as $d) {
         $this->assertEquals($obj->recv(), $d);
     }
 }