summaryrefslogtreecommitdiff
path: root/ext/spl/tests/SplFileObject_fflush_basic_001.phpt
blob: 2d8a9c80444c181eca7cd21ff85e3d93c8aaecb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--TEST--
SplFileObject::fflush function - basic test 
--FILE--
<?php
/*
 * test a successful flush
*/
$obj = New SplFileObject(dirname(__FILE__).'/SplFileObject_testinput.csv');
var_dump($obj->fflush());

/*
 * test a unsuccessful flush
*/
//create a basic stream class
class VariableStream {
    var $position;
    var $varname;

    function stream_open($path, $mode, $options, &$opened_path)
    {
        return true;
    }

    function url_stat() {
    }
}
stream_wrapper_register("SPLtest", "VariableStream");
$ftruncate_test = "";
//end creating stream

//open an SplFileObject using the above test stream
$obj = New SplFileObject("SPLtest://ftruncate_test");
var_dump($obj->fflush());

?>
--EXPECTF--
bool(true)
bool(false)