SplFileObject_fflush_basic_001.phpt 731 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. SplFileObject::fflush function - basic test
  3. --FILE--
  4. <?php
  5. /*
  6. * test a successful flush
  7. */
  8. $obj = New SplFileObject(dirname(__FILE__).'/SplFileObject_testinput.csv');
  9. var_dump($obj->fflush());
  10. /*
  11. * test a unsuccessful flush
  12. */
  13. //create a basic stream class
  14. class VariableStream {
  15. var $position;
  16. var $varname;
  17. function stream_open($path, $mode, $options, &$opened_path)
  18. {
  19. return true;
  20. }
  21. function url_stat() {
  22. }
  23. }
  24. stream_wrapper_register("SPLtest", "VariableStream");
  25. $ftruncate_test = "";
  26. //end creating stream
  27. //open an SplFileObject using the above test stream
  28. $obj = New SplFileObject("SPLtest://ftruncate_test");
  29. var_dump($obj->fflush());
  30. ?>
  31. --EXPECT--
  32. bool(true)
  33. bool(false)