From a6ac3f8c203968b4ac064884f7100fe78dc81bcd Mon Sep 17 00:00:00 2001 From: Zoe Slattery Date: Wed, 6 Jun 2007 12:50:06 +0000 Subject: [PATCH] New tests for file handling --- .../tests/file/disk_free_space_basic.phpt | 85 +++++ .../tests/file/disk_free_space_variation.phpt | 181 +++++++++ .../tests/file/disk_total_space_basic.phpt | 58 +++ .../file/disk_total_space_variation.phpt | 162 +++++++++ ext/standard/tests/file/file_basic.phpt | 123 +++++++ ext/standard/tests/file/file_error.phpt | 67 ++++ ..._get_contents_file_put_contents_basic.phpt | 60 +++ ..._get_contents_file_put_contents_error.phpt | 96 +++++ ext/standard/tests/file/file_variation.phpt | 253 +++++++++++++ .../tests/file/is_executable_variation.phpt | 251 +++++++++++++ .../tests/file/is_readable_variation.phpt | 263 ++++++++++++++ .../tests/file/is_writable_variation.phpt | 343 ++++++++++++++++++ 12 files changed, 1942 insertions(+) create mode 100644 ext/standard/tests/file/disk_free_space_basic.phpt create mode 100644 ext/standard/tests/file/disk_free_space_variation.phpt create mode 100644 ext/standard/tests/file/disk_total_space_basic.phpt create mode 100644 ext/standard/tests/file/disk_total_space_variation.phpt create mode 100644 ext/standard/tests/file/file_basic.phpt create mode 100644 ext/standard/tests/file/file_error.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt create mode 100644 ext/standard/tests/file/file_variation.phpt create mode 100644 ext/standard/tests/file/is_executable_variation.phpt create mode 100644 ext/standard/tests/file/is_readable_variation.phpt create mode 100644 ext/standard/tests/file/is_writable_variation.phpt diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt new file mode 100644 index 0000000000..9259fa72e8 --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_basic.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : basic functionality +--FILE-- + $space2 ) + echo "\n Free Space Value Is Correct\n"; +else + echo "\n Free Space Value Is Incorrect\n"; + +echo "*** Testing with Binary Input ***\n"; +var_dump( disk_free_space(b"$file_path") ); + +echo"\n--- Done ---"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Testing with existing directory *** +float(%d) +float(%d) +*** Testing with newly created directory *** + + Free Space before writing to a file +float(%d) + + Free Space after writing to a file +float(%d) + + Free Space Value Is Correct +*** Testing with Binary Input *** +float(%d) + +--- Done --- +--UEXPECTF-- +*** Testing with existing directory *** +float(%d) +float(%d) +*** Testing with newly created directory *** + + Free Space before writing to a file +float(%d) + + Free Space after writing to a file +float(%d) + + Free Space Value Is Correct +*** Testing with Binary Input *** +float(%d) + +--- Done --- diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt new file mode 100644 index 0000000000..0a799bf465 --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : Usage Variations +--FILE-- + + +--CLEAN-- + + + +--EXPECTF-- +*** Testing with a directory *** +float(%d) +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) +float(%d) + +-- Iteration 2 -- +float(%d) +float(%d) + +-- Iteration 3 -- +float(%d) +float(%d) + +-- Iteration 4 -- +float(%d) +float(%d) + +-- Iteration 5 -- +float(%d) +float(%d) + +-- Iteration 6 -- +float(%d) +float(%d) + +-- Iteration 7 -- +float(%d) +float(%d) + +-- Iteration 8 -- +float(%d) +float(%d) + +-- Iteration 9 -- +float(%d) +float(%d) + +-- Iteration 10 -- +float(%d) +float(%d) + +-- Iteration 11 -- +float(%d) +float(%d) + +-- Iteration 12 -- +float(%d) +float(%d) + +--- Done --- +--UEXPECTF-- +*** Testing with a directory *** +float(%d) +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) +float(%d) + +-- Iteration 2 -- +float(%d) +float(%d) + +-- Iteration 3 -- +float(%d) +float(%d) + +-- Iteration 4 -- +float(%d) +float(%d) + +-- Iteration 5 -- +float(%d) +float(%d) + +-- Iteration 6 -- +float(%d) +float(%d) + +-- Iteration 7 -- +float(%d) +float(%d) + +-- Iteration 8 -- +float(%d) +float(%d) + +-- Iteration 9 -- +float(%d) +float(%d) + +-- Iteration 10 -- +float(%d) +float(%d) + +-- Iteration 11 -- +float(%d) +float(%d) + +-- Iteration 12 -- +float(%d) +float(%d) + +--- Done --- diff --git a/ext/standard/tests/file/disk_total_space_basic.phpt b/ext/standard/tests/file/disk_total_space_basic.phpt new file mode 100644 index 0000000000..5b80177be0 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test disk_total_space() function : basic functionality +--FILE-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing with normal directory *** +float(%d) +*** Testing with newly created directory *** +float(%d) + +Total Space after writing to a file +float(%d) + +-- Done -- +--UEXPECTF-- +*** Testing with normal directory *** +float(%d) +*** Testing with newly created directory *** +float(%d) + +Total Space after writing to a file +float(%d) + +-- Done -- diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt new file mode 100644 index 0000000000..c4c2f0e820 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -0,0 +1,162 @@ +--TEST-- +Testing disk_total_space() functions : Usage Variations. +--FILE-- + + +--CLEAN-- + + + +--EXPECTF-- +*** Testing with a directory *** +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) + +-- Iteration 2 -- +float(%d) + +-- Iteration 3 -- +float(%d) + +-- Iteration 4 -- +float(%d) + +-- Iteration 5 -- +float(%d) + +-- Iteration 6 -- +float(%d) + +-- Iteration 7 -- +float(%d) + +-- Iteration 8 -- +float(%d) + +-- Iteration 9 -- +float(%d) + +-- Iteration 10 -- +float(%d) + +-- Iteration 11 -- +float(%d) + +-- Iteration 12 -- +float(%d) +*** Testing with Binary Input *** +float(%d) + +--- Done --- +--UEXPECTF-- +*** Testing with a directory *** +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) + +-- Iteration 2 -- +float(%d) + +-- Iteration 3 -- +float(%d) + +-- Iteration 4 -- +float(%d) + +-- Iteration 5 -- +float(%d) + +-- Iteration 6 -- +float(%d) + +-- Iteration 7 -- +float(%d) + +-- Iteration 8 -- +float(%d) + +-- Iteration 9 -- +float(%d) + +-- Iteration 10 -- +float(%d) + +-- Iteration 11 -- +float(%d) + +-- Iteration 12 -- +float(%d) +*** Testing with Binary Input *** +float(%d) + +--- Done --- diff --git a/ext/standard/tests/file/file_basic.phpt b/ext/standard/tests/file/file_basic.phpt new file mode 100644 index 0000000000..6f985555c4 --- /dev/null +++ b/ext/standard/tests/file/file_basic.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test file() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing file() with basic types of files *** +Array +( + [0] => 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 +) +Array +( + [0] => text text text text text text text text text text text text text text text text text text text text +) +Array +( +) +Array +( + [0] => line + + [1] => line of text + + [2] => line + + [3] => line of text + + [4] => line + + [5] => line of text + + [6] => line + + [7] => line of text + + [8] => line + + [9] => line of text + + [10] => line + + [11] => line +) +*** Testing for return type of file() function *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- + +--UEXPECTF-- +*** Testing file() with basic types of files *** +Array +( + [0] => 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 +) +Array +( + [0] => text text text text text text text text text text text text text text text text text text text text +) +Array +( +) +Array +( + [0] => line + + [1] => line of text + + [2] => line + + [3] => line of text + + [4] => line + + [5] => line of text + + [6] => line + + [7] => line of text + + [8] => line + + [9] => line of text + + [10] => line + + [11] => line +) +*** Testing for return type of file() function *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt new file mode 100644 index 0000000000..628eba300f --- /dev/null +++ b/ext/standard/tests/file/file_error.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test file() function : error conditions +--FILE-- + + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** +Warning: file() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: file() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: file() expects parameter 2 to be long, string given in %s on line %d +NULL +array(0) { +} + +Warning: file(temp.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +--- Done --- + +--UEXPECTF-- +*** Testing error conditions *** +Warning: file() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: file() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: file() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL +array(0) { +} + +Warning: file(temp.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +--- Done --- diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt new file mode 100644 index 0000000000..547fdd01b8 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test file_put_contents() and file_get_contents() functions : basic functionality +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing the basic functionality *** +-- Testing with simple valid data file -- +string(100) "text text text text text text text text text text text text text text text text text text text text " + +-- Testing with empty file -- +string(0) "" + +*** Done *** + +--UEXPECTF-- +*** Testing the basic functionality *** +-- Testing with simple valid data file -- +string(100) "text text text text text text text text text text text text text text text text text text text text " + +-- Testing with empty file -- +string(0) "" + +*** Done *** diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt new file mode 100644 index 0000000000..7fb1826722 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test file-get_contents() and file_put_contents() functions : error conditions +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +-- Testing with Non-existing file -- + +Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d + +-- Testing No.of arguments less than expected -- + +Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d + +Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d + +Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d + +-- Testing No.of arguments greater than expected -- + +Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d + +Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d + +-- Testing for invalid negative maxlen values -- +Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d +bool(false) + +*** Done *** + +--UEXPECTF-- +*** Testing error conditions *** + +-- Testing with Non-existing file -- + +Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d + +-- Testing No.of arguments less than expected -- + +Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d + +Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d + +-- Testing No.of arguments greater than expected -- + +Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d + +Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d + +-- Testing for invalid negative maxlen values -- +Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d +bool(false) + +*** Done *** diff --git a/ext/standard/tests/file/file_variation.phpt b/ext/standard/tests/file/file_variation.phpt new file mode 100644 index 0000000000..d70bbc497f --- /dev/null +++ b/ext/standard/tests/file/file_variation.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test file() function : Variations +--FILE-- + + +--CLEAN-- + +--EXPECTF-- +*** Using various flags values with different data in a file +--Iteration 1 -- +array(1) { + [0]=> + string(12) "Garbage data" +} +array(1) { + [0]=> + string(12) "Garbage data" +} +--Iteration 2 -- +array(4) { + [0]=> + string(3) "Gar" + [1]=> + string(2) "ba" + [2]=> + string(4) "ge d" + [3]=> + string(3) "ata" +} +array(4) { + [0]=> + string(4) "Gar +" + [1]=> + string(3) "ba +" + [2]=> + string(5) "ge d +" + [3]=> + string(3) "ata" +} +--Iteration 3 -- +array(5) { + [0]=> + string(3) "Gar" + [1]=> + string(0) "" + [2]=> + string(5) "bage " + [3]=> + string(0) "" + [4]=> + string(5) " data" +} +array(5) { + [0]=> + string(4) "Gar +" + [1]=> + string(1) " +" + [2]=> + string(6) "bage +" + [3]=> + string(1) " +" + [4]=> + string(5) " data" +} +*** Testing with variation in use_include_path argument *** +array(1) { + [0]=> + string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222" +} +array(1) { + [0]=> + string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222" +} +*** Using file function to remove line containing a key string *** +File contents in array form Before replacement of the key +array(3) { + [0]=> + string(44) "The key string to be searched is SEARCH_KEY +" + [1]=> + string(24) "Line without key string +" + [2]=> + string(43) "The key string to be searched is SEARCH_KEY" +} +File contents in array form After replacement of the key +array(1) { + [0]=> + string(24) "Line without key string +" +} + +--- Done --- + +--UEXPECTF-- +*** Using various flags values with different data in a file +--Iteration 1 -- +array(1) { + [0]=> + string(12) "Garbage data" +} +array(1) { + [0]=> + string(12) "Garbage data" +} +--Iteration 2 -- +array(4) { + [0]=> + string(3) "Gar" + [1]=> + string(2) "ba" + [2]=> + string(4) "ge d" + [3]=> + string(3) "ata" +} +array(4) { + [0]=> + string(4) "Gar +" + [1]=> + string(3) "ba +" + [2]=> + string(5) "ge d +" + [3]=> + string(3) "ata" +} +--Iteration 3 -- +array(5) { + [0]=> + string(3) "Gar" + [1]=> + string(0) "" + [2]=> + string(5) "bage " + [3]=> + string(0) "" + [4]=> + string(5) " data" +} +array(5) { + [0]=> + string(4) "Gar +" + [1]=> + string(1) " +" + [2]=> + string(6) "bage +" + [3]=> + string(1) " +" + [4]=> + string(5) " data" +} +*** Testing with variation in use_include_path argument *** +array(1) { + [0]=> + string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222" +} +array(1) { + [0]=> + string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222" +} +*** Using file function to remove line containing a key string *** +File contents in array form Before replacement of the key +array(3) { + [0]=> + string(44) "The key string to be searched is SEARCH_KEY +" + [1]=> + string(24) "Line without key string +" + [2]=> + string(43) "The key string to be searched is SEARCH_KEY" +} +File contents in array form After replacement of the key +array(1) { + [0]=> + string(24) "Line without key string +" +} + +--- Done --- diff --git a/ext/standard/tests/file/is_executable_variation.phpt b/ext/standard/tests/file/is_executable_variation.phpt new file mode 100644 index 0000000000..187adcbf74 --- /dev/null +++ b/ext/standard/tests/file/is_executable_variation.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test is_executable() function: usage variations +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing is_executable(): usage variations *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) + +*** Testing is_executable() on directory without execute permission *** +bool(false) + +*** Testing miscelleneous input for is_executable() function *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(true) + +*** Testing is_executable() on invalid files *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_executable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) +Done +--UEXPECTF-- +*** Testing is_executable(): usage variations *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) + +*** Testing is_executable() on directory without execute permission *** +bool(false) + +*** Testing miscelleneous input for is_executable() function *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(true) + +*** Testing is_executable() on invalid files *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_executable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) +Done diff --git a/ext/standard/tests/file/is_readable_variation.phpt b/ext/standard/tests/file/is_readable_variation.phpt new file mode 100644 index 0000000000..e1297a8f69 --- /dev/null +++ b/ext/standard/tests/file/is_readable_variation.phpt @@ -0,0 +1,263 @@ +--TEST-- +Test is_readable() function: usage variations +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing is_readable(): usage variations *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) +-- Iteration 11 -- +bool(true) + +*** Testing is_readable() on directory without read permission *** +bool(false) + +*** Testing miscelleneous input for is_readable() function *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) + +*** Testing is_readable() on miscelleneous filenames *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_readable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) + +Warning: is_readable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing is_readable(): usage variations *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) +-- Iteration 11 -- +bool(true) + +*** Testing is_readable() on directory without read permission *** +bool(false) + +*** Testing miscelleneous input for is_readable() function *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- +bool(true) + +*** Testing is_readable() on miscelleneous filenames *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_readable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) + +Warning: is_readable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/file/is_writable_variation.phpt b/ext/standard/tests/file/is_writable_variation.phpt new file mode 100644 index 0000000000..76453619d7 --- /dev/null +++ b/ext/standard/tests/file/is_writable_variation.phpt @@ -0,0 +1,343 @@ +--TEST-- +Test is_writable() and its alias is_writeable() function: usage variations +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing is_writable(): usage variations *** +-- Iteration 1 -- +bool(true) +bool(true) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(true) +bool(true) +-- Iteration 4 -- +bool(true) +bool(true) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(true) +bool(true) +-- Iteration 8 -- +bool(true) +bool(true) +-- Iteration 9 -- +bool(true) +bool(true) +-- Iteration 10 -- +bool(true) +bool(true) +-- Iteration 11 -- +bool(true) +bool(true) + +*** Testing is_writable() on directory without write permission *** +bool(false) +bool(false) + +*** Testing miscelleneous input for is_writable() function *** +-- Iteration 1 -- +bool(true) +bool(true) +-- Iteration 2 -- +bool(true) +bool(true) +-- Iteration 3 -- +bool(true) +bool(true) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(true) +bool(true) +-- Iteration 6 -- +bool(true) +bool(true) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(true) +bool(true) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +bool(false) +bool(false) + +*** Testing is_writable() on miscelleneous filenames *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_writable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +Warning: is_writeable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) +bool(false) + +Warning: is_writable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL + +Warning: is_writeable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing is_writable(): usage variations *** +-- Iteration 1 -- +bool(true) +bool(true) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(true) +bool(true) +-- Iteration 4 -- +bool(true) +bool(true) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(true) +bool(true) +-- Iteration 8 -- +bool(true) +bool(true) +-- Iteration 9 -- +bool(true) +bool(true) +-- Iteration 10 -- +bool(true) +bool(true) +-- Iteration 11 -- +bool(true) +bool(true) + +*** Testing is_writable() on directory without write permission *** +bool(false) +bool(false) + +*** Testing miscelleneous input for is_writable() function *** +-- Iteration 1 -- +bool(true) +bool(true) +-- Iteration 2 -- +bool(true) +bool(true) +-- Iteration 3 -- +bool(true) +bool(true) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(true) +bool(true) +-- Iteration 6 -- +bool(true) +bool(true) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(true) +bool(true) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +bool(false) +bool(false) + +*** Testing is_writable() on miscelleneous filenames *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_writable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +Warning: is_writeable() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +bool(false) +bool(false) + +Warning: is_writable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL + +Warning: is_writeable() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL +Done -- 2.50.1