fileobject_005.phpt 503 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. SPL: SplFileObject truncate tests
  3. --CREDITS--
  4. Mark Ammann
  5. #Hackday Webtuesday 2008-05-24
  6. --FILE--
  7. <?php
  8. $path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
  9. touch($path);
  10. $fo = new SplFileObject($path, 'w+', true);
  11. $fo->fwrite("blahlubba");
  12. var_dump($fo->ftruncate(4));
  13. $fo->rewind();
  14. var_dump($fo->fgets());
  15. $fo->rewind();
  16. $fo->fwrite("blahlubba");
  17. ?>
  18. --CLEAN--
  19. <?php
  20. $path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
  21. unlink($path);
  22. ?>
  23. --EXPECT--
  24. bool(true)
  25. string(4) "blah"