Annotation of embedaddon/php/ext/standard/tests/file/disk_free_space_basic.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test disk_free_space and its alias diskfreespace() functions : basic functionality
1.1.1.2 ! misho 3: --SKIPIF--
! 4: <?php
! 5: if (getenv("TRAVIS") === "true") die("skip inaccurate on TravisCI");
! 6: ?>
1.1 misho 7: --INI--
8: memory_limit=32M
9: --FILE--
10: <?php
11: /*
12: * Prototype: float disk_free_space( string directory )
13: * Description: Given a string containing a directory, this function
14: * will return the number of bytes available on the corresponding
15: * filesystem or disk partition
16: */
17:
18: $file_path = dirname(__FILE__);
19:
20: echo "*** Testing with existing directory ***\n";
21: var_dump( disk_free_space($file_path) );
22: var_dump( diskfreespace($file_path) );
23:
24: echo "*** Testing with newly created directory ***\n";
25: $dir = "/disk_free_space";
26: mkdir($file_path.$dir);
27: echo" \n Free Space before writing to a file\n";
28: $space1 = disk_free_space($file_path.$dir);
29: var_dump( $space1 );
30:
31: $fh = fopen($file_path.$dir."/disk_free_space.tmp", "a");
32: $data = str_repeat("x", 4096);
33: fwrite($fh, (binary)$data);
34: fclose($fh);
35:
36: echo "\n Free Space after writing to a file\n";
37: $space2 = disk_free_space($file_path.$dir);
38: var_dump( $space2 );
39:
40: if( $space1 > $space2 )
41: echo "\n Free Space Value Is Correct\n";
42: else
43: echo "\n Free Space Value Is Incorrect\n";
44:
45: echo "*** Testing with Binary Input ***\n";
46: var_dump( disk_free_space(b"$file_path") );
47:
48: echo"\n--- Done ---";
49: ?>
50:
51: --CLEAN--
52: <?php
53: $file_path = dirname(__FILE__);
54: unlink($file_path."/disk_free_space/disk_free_space.tmp");
55: rmdir($file_path."/disk_free_space");
56: ?>
57:
58: --EXPECTF--
59: *** Testing with existing directory ***
60: float(%d)
61: float(%d)
62: *** Testing with newly created directory ***
63:
64: Free Space before writing to a file
65: float(%d)
66:
67: Free Space after writing to a file
68: float(%d)
69:
70: Free Space Value Is Correct
71: *** Testing with Binary Input ***
72: float(%d)
73:
74: --- Done ---
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>