From: Raghubansh Kumar Date: Thu, 21 Jun 2007 21:14:21 +0000 (+0000) Subject: New tests for file system handling functions X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~408 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f3b30d648229dbc4940bc029cb90976088e6b7;p=php New tests for file system handling functions --- diff --git a/ext/standard/tests/file/filesize_variation-win32.phpt b/ext/standard/tests/file/filesize_variation-win32.phpt new file mode 100644 index 0000000000..2d28b1e330 --- /dev/null +++ b/ext/standard/tests/file/filesize_variation-win32.phpt @@ -0,0 +1,301 @@ +--TEST-- +Test filesize() function: usage variations +--SKIPIF-- +=-1200; $size-=1200) { + $file_handle = fopen($filename, "r+"); + var_dump( ftruncate($file_handle, $size) ); + fclose($file_handle); + var_dump( filesize($filename) ); + clearstatcache(); +} + +echo "-- Testing filesize() with the data of possible chars --\n"; +$filename2 = $file_path."/filesize_variation1.tmp"; +$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) chars, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0"; +echo "-- opening the file in 'w' mode and get the size --\n"; +$file_handle = fopen($filename2, "w"); +var_dump( strlen($string) ); //strlen of the string +fwrite($file_handle, $string); +fclose($file_handle); +var_dump( filesize($filename2) ); //size of the file = strlen of string +clearstatcache(); + +echo "-- opening the file in 'wt' mode and get the size --\n"; +$file_handle = fopen($filename2, "wt"); +var_dump( strlen($string) ); //strlen of the string = 191 bytes +fwrite($file_handle, $string); +fclose($file_handle); +var_dump( filesize($filename2) ); //size of the file = 192 bytes != strlen of string +clearstatcache(); + +echo "-- opening the file in 'a' mode, adding data and checking the file --\n"; +$file_handle = fopen($filename2, "a"); +fwrite($file_handle, "Hello, world"); +fclose($file_handle); +var_dump( filesize($filename2) ); //204 bytes +clearstatcache(); + +echo "-- opening the file in 'at' mode, adding data and checking the file --\n"; +$file_handle = fopen($filename2, "at"); +fwrite($file_handle, "Hello, world\n"); +fclose($file_handle); +var_dump( filesize($filename2) ); //218 bytes +clearstatcache(); + +echo "-- creating a hole and checking the size --\n"; +$file_handle = fopen($filename2, "a"); +var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole +fclose($file_handle); +var_dump( filesize($filename2) ); //220 bytes +clearstatcache(); + +echo "-- writing data after hole and checking the size --\n"; +$file_handle = fopen($filename2, "a"); +fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data +fclose($file_handle); +var_dump( filesize($filename2) ); //226 bytes +clearstatcache(); + +echo "-- opening the existing file in write mode --\n"; +fclose( fopen($filename2, "w") ); +var_dump( filesize($filename2) ); //0 bytes +clearstatcache(); + +echo "-- with empty file --\n"; +$filename3 = dirname(__FILE__)."/filesize_variation_empty.tmp"; +fclose( fopen($filename3, "w") ); +var_dump( filesize($filename3) ); //0 bytes + +echo "*** Done ***\n"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing filesize(): usage variations *** +*** Checking filesize() with different size of files *** +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) + +*** Testing size of a dir, sub-dir and file with filesize() *** +-- Creating a base dir, and checking its size -- +int(0) +-- Creating a file inside base dir, and checking dir & file size -- +int(0) +int(1024) +-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir -- +int(0) +int(0) +-- Creating a file inside sub-dir, and checking size of base, subdir and file created -- +int(0) +int(0) +int(12000) +-- Testing filesize() after truncating the file to a new length -- +bool(true) +int(12000) +bool(true) +int(10800) +bool(true) +int(9600) +bool(true) +int(8400) +bool(true) +int(7200) +bool(true) +int(6000) +bool(true) +int(4800) +bool(true) +int(3600) +bool(true) +int(2400) +bool(true) +int(1200) +bool(true) +int(0) +bool(false) +int(0) +-- Testing filesize() with the data of possible chars -- +-- opening the file in 'w' mode and get the size -- +int(191) +int(191) +-- opening the file in 'wt' mode and get the size -- +int(191) +int(192) +-- opening the file in 'a' mode, adding data and checking the file -- +int(204) +-- opening the file in 'at' mode, adding data and checking the file -- +int(218) +-- creating a hole and checking the size -- +bool(true) +int(220) +-- writing data after hole and checking the size -- +int(226) +-- opening the existing file in write mode -- +int(0) +-- with empty file -- +int(0) +*** Done *** +--UEXPECTF-- +*** Testing filesize(): usage variations *** +*** Checking filesize() with different size of files *** +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) + +*** Testing size of a dir, sub-dir and file with filesize() *** +-- Creating a base dir, and checking its size -- +int(0) +-- Creating a file inside base dir, and checking dir & file size -- +int(0) +int(1024) +-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir -- +int(0) +int(0) +-- Creating a file inside sub-dir, and checking size of base, subdir and file created -- + +Notice: fwrite(): 12000 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(0) +int(0) +int(12000) +-- Testing filesize() after truncating the file to a new length -- +bool(true) +int(12000) +bool(true) +int(10800) +bool(true) +int(9600) +bool(true) +int(8400) +bool(true) +int(7200) +bool(true) +int(6000) +bool(true) +int(4800) +bool(true) +int(3600) +bool(true) +int(2400) +bool(true) +int(1200) +bool(true) +int(0) +bool(false) +int(0) +-- Testing filesize() with the data of possible chars -- +-- opening the file in 'w' mode and get the size -- +int(191) + +Notice: fwrite(): 191 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(191) +-- opening the file in 'wt' mode and get the size -- +int(191) +int(192) +-- opening the file in 'a' mode, adding data and checking the file -- + +Notice: fwrite(): 12 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(204) +-- opening the file in 'at' mode, adding data and checking the file -- +int(218) +-- creating a hole and checking the size -- +bool(true) +int(220) +-- writing data after hole and checking the size -- + +Notice: fwrite(): 6 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(226) +-- opening the existing file in write mode -- +int(0) +-- with empty file -- +int(0) +*** Done *** diff --git a/ext/standard/tests/file/filesize_variation.phpt b/ext/standard/tests/file/filesize_variation.phpt new file mode 100644 index 0000000000..5cdf11bf46 --- /dev/null +++ b/ext/standard/tests/file/filesize_variation.phpt @@ -0,0 +1,301 @@ +--TEST-- +Test filesize() function: usage variations +--SKIPIF-- +=-1200; $size-=1200) { + $file_handle = fopen($filename, "r+"); + var_dump( ftruncate($file_handle, $size) ); + fclose($file_handle); + var_dump( filesize($filename) ); + clearstatcache(); +} + +echo "-- Testing filesize() with the data of possible chars --\n"; +$filename2 = $file_path."/filesize_variation1.tmp"; +$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) chars, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0"; +echo "-- opening the file in 'w' mode and get the size --\n"; +$file_handle = fopen($filename2, "w"); +var_dump( strlen($string) ); //strlen of the string +fwrite($file_handle, $string); +fclose($file_handle); +var_dump( filesize($filename2) ); //size of the file = strlen of string +clearstatcache(); + +echo "-- opening the file in 'w' mode and get the size --\n"; +$file_handle = fopen($filename2, "wt"); +var_dump( strlen($string) ); //strlen of the string = 191 bytes +fwrite($file_handle, $string); +fclose($file_handle); +var_dump( filesize($filename2) ); //size of the file = strlen of string = 191 bytes +clearstatcache(); + +echo "-- opening the file in 'a' mode, adding data and checking the file --\n"; +$file_handle = fopen($filename2, "a"); +fwrite($file_handle, "Hello, world"); +fclose($file_handle); +var_dump( filesize($filename2) ); //203 bytes +clearstatcache(); + +echo "-- opening the file in 'at' mode, adding data and checking the file --\n"; +$file_handle = fopen($filename2, "at"); +fwrite($file_handle, "Hello, world\n"); +fclose($file_handle); +var_dump( filesize($filename2) ); //216 bytes +clearstatcache(); + +echo "-- creating a hole and checking the size --\n"; +$file_handle = fopen($filename2, "a"); +var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole +fclose($file_handle); +var_dump( filesize($filename2) ); //220 bytes +clearstatcache(); + +echo "-- writing data after hole and checking the size --\n"; +$file_handle = fopen($filename2, "a"); +fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data +fclose($file_handle); +var_dump( filesize($filename2) ); //226 bytes +clearstatcache(); + +echo "-- opening the existing file in write mode --\n"; +fclose( fopen($filename2, "w") ); +var_dump( filesize($filename2) ); //0 bytes +clearstatcache(); + +echo "-- with empty file --\n"; +$filename3 = dirname(__FILE__)."/filesize_variation_empty.tmp"; +fclose( fopen($filename3, "w") ); +var_dump( filesize($filename3) ); //0 bytes + +echo "*** Done ***\n"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing filesize(): usage variations *** +*** Checking filesize() with different size of files *** +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) + +*** Testing size of a dir, sub-dir and file with filesize() *** +-- Creating a base dir, and checking its size -- +int(4096) +-- Creating a file inside base dir, and checking dir & file size -- +int(4096) +int(1024) +-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir -- +int(4096) +int(4096) +-- Creating a file inside sub-dir, and checking size of base, subdir and file created -- +int(4096) +int(4096) +int(12000) +-- Testing filesize() after truncating the file to a new length -- +bool(true) +int(12000) +bool(true) +int(10800) +bool(true) +int(9600) +bool(true) +int(8400) +bool(true) +int(7200) +bool(true) +int(6000) +bool(true) +int(4800) +bool(true) +int(3600) +bool(true) +int(2400) +bool(true) +int(1200) +bool(true) +int(0) +bool(false) +int(0) +-- Testing filesize() with the data of possible chars -- +-- opening the file in 'w' mode and get the size -- +int(191) +int(191) +-- opening the file in 'w' mode and get the size -- +int(191) +int(191) +-- opening the file in 'a' mode, adding data and checking the file -- +int(203) +-- opening the file in 'at' mode, adding data and checking the file -- +int(216) +-- creating a hole and checking the size -- +bool(true) +int(220) +-- writing data after hole and checking the size -- +int(226) +-- opening the existing file in write mode -- +int(0) +-- with empty file -- +int(0) +*** Done *** +--UEXPECTF-- +*** Testing filesize(): usage variations *** +*** Checking filesize() with different size of files *** +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) + +*** Testing size of a dir, sub-dir and file with filesize() *** +-- Creating a base dir, and checking its size -- +int(4096) +-- Creating a file inside base dir, and checking dir & file size -- +int(4096) +int(1024) +-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir -- +int(4096) +int(4096) +-- Creating a file inside sub-dir, and checking size of base, subdir and file created -- + +Notice: fwrite(): 12000 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(4096) +int(4096) +int(12000) +-- Testing filesize() after truncating the file to a new length -- +bool(true) +int(12000) +bool(true) +int(10800) +bool(true) +int(9600) +bool(true) +int(8400) +bool(true) +int(7200) +bool(true) +int(6000) +bool(true) +int(4800) +bool(true) +int(3600) +bool(true) +int(2400) +bool(true) +int(1200) +bool(true) +int(0) +bool(false) +int(0) +-- Testing filesize() with the data of possible chars -- +-- opening the file in 'w' mode and get the size -- +int(191) + +Notice: fwrite(): 191 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(191) +-- opening the file in 'w' mode and get the size -- +int(191) +int(191) +-- opening the file in 'a' mode, adding data and checking the file -- + +Notice: fwrite(): 12 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(203) +-- opening the file in 'at' mode, adding data and checking the file -- +int(216) +-- creating a hole and checking the size -- +bool(true) +int(220) +-- writing data after hole and checking the size -- + +Notice: fwrite(): 6 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +int(226) +-- opening the existing file in write mode -- +int(0) +-- with empty file -- +int(0) +*** Done *** diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt new file mode 100644 index 0000000000..d8bc04e817 --- /dev/null +++ b/ext/standard/tests/file/lstat_stat_basic.phpt @@ -0,0 +1,545 @@ +--TEST-- +Test lstat() & stat() functions: basic functionality +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing lstat() & stat() : basic functionality *** +*** Testing stat() and lstat() : validating the values stored in stat *** +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +*** Testing stat() and lstat() : comparing stats (recorded before and after file/link creation) *** +-- comparing difference in dir stats before and after creating file in it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +bool(true) +-- comparing difference in file stats before and after creating link to it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +bool(true) +Done +--UEXPECTF-- +*** Testing lstat() & stat() : basic functionality *** +*** Testing stat() and lstat() : validating the values stored in stat *** +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +*** Testing stat() and lstat() : comparing stats (recorded before and after file/link creation) *** +-- comparing difference in dir stats before and after creating file in it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +bool(true) +-- comparing difference in file stats before and after creating link to it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +bool(true) +Done diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt new file mode 100644 index 0000000000..b68aa4daa8 --- /dev/null +++ b/ext/standard/tests/file/lstat_stat_error.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test lstat() and stat() functions: error conditions +--SKIPIF-- + +--FILE-- + expected +var_dump( lstat("$file_path/temp.tmp") ); // non existing file +var_dump( lstat(22) ); // scalar argument +$arr = array(__FILE__); +var_dump( lstat($arr) ); // array argument + +echo "\n*** Testing stat() for error conditions ***\n"; +var_dump( stat() ); // args < expected +var_dump( stat(__FILE__, 2) ); // file, args > expected +var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected + +var_dump( stat("$file_path/temp.tmp") ); // non existing file +var_dump( stat("$file_path/temp/") ); // non existing dir +var_dump( stat(22) ); // scalar argument +var_dump( stat($arr) ); // array argument + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing lstat() for error conditions *** + +Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: lstat(): Lstat failed for %s in %s on line %d +bool(false) + +Warning: lstat(): Lstat failed for 22 in %s on line %d +bool(false) + +Warning: lstat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +*** Testing stat() for error conditions *** + +Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for 22 in %s on line %d +bool(false) + +Warning: stat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing lstat() for error conditions *** + +Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: lstat(): Lstat failed for %s in %s on line %d +bool(false) + +Warning: lstat(): Lstat failed for 22 in %s on line %d +bool(false) + +Warning: lstat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +*** Testing stat() for error conditions *** + +Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for 22 in %s on line %d +bool(false) + +Warning: stat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/file/rename_variation-win32.phpt b/ext/standard/tests/file/rename_variation-win32.phpt new file mode 100644 index 0000000000..19ab560a6c --- /dev/null +++ b/ext/standard/tests/file/rename_variation-win32.phpt @@ -0,0 +1,304 @@ +--TEST-- +Test rename() function: usage variations +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing variations of rename() on files *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: unlink(%s): No such file or directory in %s on line %d + +*** Testing variations of rename() on directories *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 5 -- + +Warning: rename(.,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 6 -- + +Warning: rename(,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 7 -- + +Warning: rename(,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 8 -- + +Warning: rename( ,%s): File exists in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 9 -- + +Warning: rename( ,%s): File exists in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d + +*** Testing rename() with non-existing file and directory *** + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +*** Testing rename() by renaming a file and directory to numeric name *** +bool(true) +bool(true) + +*** Testing rename() with miscelleneous input *** + +-- Renaming file to same file name -- +bool(true) + +-- Renaming directory to same directory name -- +bool(true) + +-- Renaming existing file to directory name -- + +Warning: rename(%s,%s): File exists in %s on line %d +bool(false) + +-- Renaming existing directory to file name -- + +Warning: rename(%s,%s): File exists in %s on line %d +bool(false) +Done +--UEXPECTF-- +*** Testing variations of rename() on files *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: unlink(%s): No such file or directory in %s on line %d + +*** Testing variations of rename() on directories *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 5 -- + +Warning: rename(.,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 6 -- + +Warning: rename(,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 7 -- + +Warning: rename(,%s): Permission denied in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 8 -- + +Warning: rename( ,%s): File exists in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d +-- Iteration 9 -- + +Warning: rename( ,%s): File exists in %s on line %d +bool(false) + +Warning: rmdir(%s): No such file or directory in %s on line %d + +*** Testing rename() with non-existing file and directory *** + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +Warning: rename(%s,%s): No such file or directory in %s on line %d +bool(false) + +*** Testing rename() by renaming a file and directory to numeric name *** +bool(true) +bool(true) + +*** Testing rename() with miscelleneous input *** + +-- Renaming file to same file name -- +bool(true) + +-- Renaming directory to same directory name -- +bool(true) + +-- Renaming existing file to directory name -- + +Warning: rename(%s,%s): File exists in %s on line %d +bool(false) + +-- Renaming existing directory to file name -- + +Warning: rename(%s,%s): File exists in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/rename_variation.phpt b/ext/standard/tests/file/rename_variation.phpt new file mode 100644 index 0000000000..2617b7c723 --- /dev/null +++ b/ext/standard/tests/file/rename_variation.phpt @@ -0,0 +1,408 @@ +--TEST-- +Test rename() function: usage variations +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing rename() : rename files across directories *** +-- Iteration 1 -- +bool(true) +bool(false) +bool(true) +-- Iteration 2 -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: unlink(%s): No such file or directory in %s on line %d +-- Iteration 3 -- +bool(true) +bool(false) +bool(true) +-- Iteration 4 -- +bool(true) +bool(false) +bool(true) + +*** Testing rename() : renaming directory across directories *** +-- Iteration 1 -- +bool(true) +bool(false) +bool(true) +-- Iteration 2 -- +bool(true) +bool(false) +bool(true) +-- Iteration 3 -- +bool(true) +bool(false) +bool(true) + +*** Testing rename() on soft links *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +*** Testing rename() on hard links *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +*** Testing rename() by renaming a file, link and directory to numeric name *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +-- Renaming link to same link name -- +bool(true) + +-- Renaming file to same file name -- +bool(true) + +-- Renaming directory to same directory name -- +bool(true) + +-- Renaming existing link to existing directory name -- + +Warning: rename(%s,%s): Is a directory in %s on line %d +bool(false) + +-- Renaming existing link to existing file name -- +bool(true) + +-- Renaming existing file to existing directory name -- + +Warning: rename(%s,%s): Is a directory in %s on line %d +bool(false) + +-- Renaming existing file to existing link name -- +bool(true) + +-- Renaming existing directory to existing file name -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) + +-- Renaming existing directory to existing link name -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) +Done + +--UEXPECTF-- +*** Testing rename() : rename files across directories *** +-- Iteration 1 -- +bool(true) +bool(false) +bool(true) +-- Iteration 2 -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: unlink(%s): No such file or directory in %s on line %d +-- Iteration 3 -- +bool(true) +bool(false) +bool(true) +-- Iteration 4 -- +bool(true) +bool(false) +bool(true) + +*** Testing rename() : renaming directory across directories *** +-- Iteration 1 -- +bool(true) +bool(false) +bool(true) +-- Iteration 2 -- +bool(true) +bool(false) +bool(true) +-- Iteration 3 -- +bool(true) +bool(false) +bool(true) + +*** Testing rename() on soft links *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +*** Testing rename() on hard links *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +*** Testing rename() by renaming a file, link and directory to numeric name *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) + +-- Renaming link to same link name -- +bool(true) + +-- Renaming file to same file name -- +bool(true) + +-- Renaming directory to same directory name -- +bool(true) + +-- Renaming existing link to existing directory name -- + +Warning: rename(%s,%s): Is a directory in %s on line %d +bool(false) + +-- Renaming existing link to existing file name -- +bool(true) + +-- Renaming existing file to existing directory name -- + +Warning: rename(%s,%s): Is a directory in %s on line %d +bool(false) + +-- Renaming existing file to existing link name -- +bool(true) + +-- Renaming existing directory to existing file name -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) + +-- Renaming existing directory to existing link name -- + +Warning: rename(%s,%s): Not a directory in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/stat_basic-win32.phpt b/ext/standard/tests/file/stat_basic-win32.phpt new file mode 100644 index 0000000000..47a8fc264e --- /dev/null +++ b/ext/standard/tests/file/stat_basic-win32.phpt @@ -0,0 +1,313 @@ +--TEST-- +Test stat() function: basic functionality +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing stat() : basic functionality *** +*** Testing stat(): validating the values stored in stat *** +bool(true) +bool(true) +bool(true) +*** Testing stat(): comparing stats (recorded before and after file creation) *** +-- comparing difference in dir stats before and after creating file in it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(-1) + ["blocks"]=> + int(-1) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(-1) + ["blocks"]=> + int(-1) +} +bool(true) +*** Testing stat(): for the return value *** +bool(true) + +---Done--- + +--UEXPECTF-- +*** Testing stat() : basic functionality *** +*** Testing stat(): validating the values stored in stat *** +bool(true) +bool(true) +bool(true) +*** Testing stat(): comparing stats (recorded before and after file creation) *** +-- comparing difference in dir stats before and after creating file in it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(-1) + [u"blocks"]=> + int(-1) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(-1) + [u"blocks"]=> + int(-1) +} +bool(true) +*** Testing stat(): for the return value *** +bool(true) + +---Done--- diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt new file mode 100644 index 0000000000..55010e6c58 --- /dev/null +++ b/ext/standard/tests/file/stat_error-win32.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test stat() function: error conditions +--SKIPIF-- + +--FILE-- + expected +var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected + +var_dump( stat("$file_path/temp.tmp") ); // non existing file +var_dump( stat("$file_path/temp/") ); // non existing dir +var_dump( stat(22) ); // scalar argument +var_dump( stat($arr) ); // array argument + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing stat() for error conditions *** + +Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for 22 in %s on line %d +bool(false) + +Warning: stat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +Done + +--UEXPECTF-- +*** Testing stat() for error conditions *** + +Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for %s in %s on line %d +bool(false) + +Warning: stat(): stat failed for 22 in %s on line %d +bool(false) + +Warning: stat() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +Done