1--TEST--
2int set_file_buffer ( resource $stream , int $buffer );
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
5--FILE--
6<?php
7
8class test_wrapper {
9  public $context;
10
11  function stream_open($path, $mode, $openedpath) {
12    return true;
13  }
14
15  function stream_eof() {
16    return false;
17  }
18
19  function stream_write($data) {
20    echo "size: ", strlen($data), "\n";
21    return strlen($data);
22  }
23
24  function stream_set_option($option, $arg1, $arg2) {
25    echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
26    return false;
27  }
28}
29
30var_dump(stream_wrapper_register('test', 'test_wrapper'));
31$fd = fopen("test://foo","r");
32var_dump(set_file_buffer($fd, 50));
33var_dump(stream_set_chunk_size($fd, 42));
34var_dump(fwrite($fd, str_repeat('0', 70)));
35?>
36--EXPECTF--
37bool(true)
38option: %d, %d, %d
39int(%i)
40int(%d)
41size: %d
42size: 28
43int(%d)
44