Create post-HADVAs expect files
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / file / file_put_contents_variation6.php
blob3fc648406ec2a307c12ddc8a387a47961b8a4b90
1 <?hh
2 /* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
3 * Description: Write/Create a file with contents data and return the number of bytes written
4 * Source code: ext/standard/file.c
5 * Alias to functions:
6 */
8 function runtest() {
11 //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
12 // in the include path. In this case it doesn't so the file should be written in the current dir.
14 file_put_contents(ZendGoodExtStandardTestsFileFilePutContentsVariation6::$filename, (string)"File in include path", FILE_USE_INCLUDE_PATH);
15 file_put_contents(ZendGoodExtStandardTestsFileFilePutContentsVariation6::$filename, (string)". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
16 $line = file_get_contents(ZendGoodExtStandardTestsFileFilePutContentsVariation6::$filename);
17 echo "$line\n";
18 unlink(ZendGoodExtStandardTestsFileFilePutContentsVariation6::$filename);
21 abstract final class ZendGoodExtStandardTestsFileFilePutContentsVariation6 {
22 public static $filename;
24 <<__EntryPoint>> function main(): void {
25 require_once('fopen_include_path.inc');
27 echo "*** Testing file_put_contents() : variation ***\n";
29 $thisTestDir = __SystemLib\hphp_test_tmppath('dir');
30 mkdir($thisTestDir);
31 $oldDirPath = getcwd();
32 chdir($thisTestDir);
34 ZendGoodExtStandardTestsFileFilePutContentsVariation6::$filename = basename(__FILE__, ".php") . ".tmp";
36 $newpath = create_include_path();
37 set_include_path($newpath);
38 runtest();
40 $newpath = generate_next_path();
41 set_include_path($newpath);
42 runtest();
44 teardown_include_path();
45 restore_include_path();
46 chdir($oldDirPath);
47 rmdir($thisTestDir);
50 echo "===DONE===\n";