From: Dave Kelsey Date: Thu, 22 Jan 2009 20:49:50 +0000 (+0000) Subject: fstat tests. tested on windows, linux and linux 64 bit X-Git-Tag: php-5.2.9RC1~55 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e815e613ac1495976cee209030266a99681a9579;p=php fstat tests. tested on windows, linux and linux 64 bit --- diff --git a/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt new file mode 100644 index 0000000000..87f85230b5 --- /dev/null +++ b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test function fstat() on directory wrapper +--FILE-- + +===DONE=== +--EXPECT-- +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_basic.phpt b/ext/standard/tests/file/fstat_basic.phpt new file mode 100644 index 0000000000..a404929a25 --- /dev/null +++ b/ext/standard/tests/file/fstat_basic.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test function fstat() by calling it with its expected arguments +--FILE-- + +===DONE=== +--EXPECTF-- +array(26) { + [0]=> + int(%i) + [1]=> + int(%i) + [2]=> + int(%i) + [3]=> + int(%i) + [4]=> + int(%i) + [5]=> + int(%i) + [6]=> + int(%i) + [7]=> + int(%i) + [8]=> + int(%i) + [9]=> + int(%i) + [10]=> + int(%i) + [11]=> + int(%i) + [12]=> + int(%i) + ["dev"]=> + int(%i) + ["ino"]=> + int(%i) + ["mode"]=> + int(%i) + ["nlink"]=> + int(%i) + ["uid"]=> + int(%i) + ["gid"]=> + int(%i) + ["rdev"]=> + int(%i) + ["size"]=> + int(%i) + ["atime"]=> + int(%i) + ["mtime"]=> + int(%i) + ["ctime"]=> + int(%i) + ["blksize"]=> + int(%i) + ["blocks"]=> + int(%i) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_error.phpt b/ext/standard/tests/file/fstat_error.phpt new file mode 100644 index 0000000000..69a7f0bec4 --- /dev/null +++ b/ext/standard/tests/file/fstat_error.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test function fstat() by calling it more than or less than its expected arguments +--FILE-- + +===DONE=== +--EXPECTF-- + +Warning: Wrong parameter count for fstat() in %s on line %d +NULL + +Warning: Wrong parameter count for fstat() in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation1.phpt b/ext/standard/tests/file/fstat_variation1.phpt new file mode 100644 index 0000000000..4607323883 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation1.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test function fstat() by substituting agument 1 with array values. +--FILE-- + 'one', 2 => 'two'); + +$variation_array = array( + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation2.phpt b/ext/standard/tests/file/fstat_variation2.phpt new file mode 100644 index 0000000000..6f59efcfe2 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation2.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test function fstat() by substituting agument 1 with boolean values. +--FILE-- + true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation3.phpt b/ext/standard/tests/file/fstat_variation3.phpt new file mode 100644 index 0000000000..32dadd8b56 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation3.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test function fstat() by substituting agument 1 with emptyUnsetUndefNull values. +--FILE-- + @$unset_var, + 'undefined var' => @$undefined_var, + 'empty string DQ' => "", + 'empty string SQ' => '', + 'uppercase NULL' => NULL, + 'lowercase null' => null, + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation4.phpt b/ext/standard/tests/file/fstat_variation4.phpt new file mode 100644 index 0000000000..cabd83dba0 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation4.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test function fstat() by substituting agument 1 with float values. +--FILE-- + 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation5.phpt b/ext/standard/tests/file/fstat_variation5.phpt new file mode 100644 index 0000000000..59fbb37d1a --- /dev/null +++ b/ext/standard/tests/file/fstat_variation5.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test function fstat() by substituting agument 1 with int values. +--FILE-- + 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation6.phpt b/ext/standard/tests/file/fstat_variation6.phpt new file mode 100644 index 0000000000..1221627813 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation6.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test function fstat() by substituting agument 1 with object values. +--FILE-- + new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- +Error: 2 - fstat(): supplied argument is not a valid stream resource, %s(%d) +bool(false) +Error: 2 - fstat(): supplied argument is not a valid stream resource, %s(%d) +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation7.phpt b/ext/standard/tests/file/fstat_variation7.phpt new file mode 100644 index 0000000000..a00d2485a4 --- /dev/null +++ b/ext/standard/tests/file/fstat_variation7.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test function fstat() by substituting agument 1 with string values. +--FILE-- + "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + ); + + +foreach ( $variation_array as $var ) { + var_dump(fstat( $var ) ); +} +?> +===DONE=== +--EXPECTF-- + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Warning: fstat(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fstat_variation8.phpt b/ext/standard/tests/file/fstat_variation8.phpt new file mode 100644 index 0000000000..b493d4ec9c --- /dev/null +++ b/ext/standard/tests/file/fstat_variation8.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test function fstat() by calling it with its expected arguments +--FILE-- +$value) { + if ($isWin && ($key === 0 || $key === 6 || $key === 'dev' || $key === 'rdev')) { + // windows, dev and rdev will not match this is expected + } + else { + if ($fstat_result[$key] != $value) { + echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n"; + $failed = true; + } + } +} +if ($failed !== true) { + echo "PASSED: all elements are the same\n"; +} + + +?> +===DONE=== +--EXPECT-- +PASSED: all elements are the same +===DONE=== \ No newline at end of file