Beispiel #1
0
 public function testDecoratesWithCustomizations()
 {
     $this->_closure_var_testDecoratesWithCustomizations_called = false;
     $this->_closure_var_testDecoratesWithCustomizations_a = puzzle_stream_Stream::factory('foo');
     $b = puzzle_stream_FnStream::decorate($this->_closure_var_testDecoratesWithCustomizations_a, array('read' => array($this, '__callback_testDecoratesWithCustomizations')));
     $this->assertEquals('foo', $b->read(3));
     $this->assertTrue($this->_closure_var_testDecoratesWithCustomizations_called);
 }
Beispiel #2
0
 public function testStopsCopyToSteamWhenReadFailsWithMaxLen()
 {
     $s1 = puzzle_stream_Stream::factory('foobaz');
     $s1 = puzzle_stream_FnStream::decorate($s1, array('read' => array($this, '__callback_returnEmpty')));
     $s2 = puzzle_stream_Stream::factory('');
     puzzle_stream_Utils::copyToStream($s1, $s2, 10);
     $this->assertEquals('', (string) $s2);
 }