fopen_variation13.phpt 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test fopen() function : variation: use include path create a file (absolute)
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --FILE--
  6. <?php
  7. require_once('fopen_include_path.inc');
  8. echo "*** Testing fopen() : variation ***\n";
  9. $newpath = create_include_path();
  10. set_include_path($newpath);
  11. runtest();
  12. $newpath = generate_next_path();
  13. set_include_path($newpath);
  14. runtest();
  15. teardown_include_path();
  16. function runtest() {
  17. $tempDir = 'fopen_variation13.dir.tmp';
  18. $tmpfile = 'fopen_variation13.tmp';
  19. $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
  20. mkdir($tempDir);
  21. $h = fopen($absFile, "w", true);
  22. fwrite($h, "This is the test file");
  23. fclose($h);
  24. $h = fopen($absFile, "r");
  25. if ($h === false) {
  26. echo "Not created absolute location\n";
  27. }
  28. else {
  29. echo "Created in correct location\n";
  30. fclose($h);
  31. }
  32. unlink($absFile);
  33. rmdir($tempDir);
  34. }
  35. ?>
  36. --EXPECT--
  37. *** Testing fopen() : variation ***
  38. Created in correct location
  39. Created in correct location