Skip to content

Commit 784762c

Browse files
committed
file test fixes
1 parent 1fd8ec5 commit 784762c

File tree

81 files changed

+248
-1766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+248
-1766
lines changed

ext/standard/tests/file/005_error.phpt

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") );
2929
var_dump( filectime("/no/such/file/or/dir") );
3030
var_dump( touch("/no/such/file/or/dir", 10) );
3131

32-
/* Only one invalid argument */
33-
var_dump( fileatime(__FILE__, "string") );
34-
var_dump( filemtime(__FILE__, 100) );
35-
var_dump( filectime(__FILE__, TRUE) );
36-
var_dump( touch(__FILE__, 10, 100, 123) );
37-
38-
echo "\n-- Testing No.of arguments less than expected --";
39-
var_dump( fileatime() );
40-
var_dump( filemtime() );
41-
var_dump( filectime() );
42-
var_dump( touch() );
43-
44-
echo "\n-- Testing No.of arguments greater than expected --";
45-
/* Both invalid arguments */
46-
var_dump( fileatime("/no/such/file/or/dir", "string") );
47-
var_dump( filemtime("/no/such/file/or/dir", 100) );
48-
var_dump( filectime("/no/such/file/or/dir", TRUE) );
49-
var_dump( touch("/no/such/file/or/dir", 10, 100, 123) );
50-
51-
/* Only one invalid argument */
52-
var_dump( fileatime(__FILE__, "string") );
53-
var_dump( filemtime(__FILE__, 100) );
54-
var_dump( filectime(__FILE__, TRUE) );
55-
var_dump( touch(__FILE__, 10, 100, 123) );
56-
5732
echo "\nDone";
5833
?>
5934
--EXPECTF--
@@ -72,54 +47,4 @@ bool(false)
7247
Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d
7348
bool(false)
7449

75-
Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
76-
NULL
77-
78-
Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
79-
NULL
80-
81-
Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
82-
NULL
83-
84-
Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
85-
NULL
86-
87-
-- Testing No.of arguments less than expected --
88-
Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d
89-
NULL
90-
91-
Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d
92-
NULL
93-
94-
Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d
95-
NULL
96-
97-
Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
98-
NULL
99-
100-
-- Testing No.of arguments greater than expected --
101-
Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
102-
NULL
103-
104-
Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
105-
NULL
106-
107-
Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
108-
NULL
109-
110-
Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
111-
NULL
112-
113-
Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
114-
NULL
115-
116-
Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
117-
NULL
118-
119-
Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
120-
NULL
121-
122-
Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
123-
NULL
124-
12550
Done

ext/standard/tests/file/006_error.phpt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,6 @@ var_dump( chmod("/no/such/file/dir", 0777) );
4646
var_dump( fileperms("/no/such/file/dir") );
4747
echo "\n";
4848

49-
/* With args less than expected */
50-
$fp = fopen(dirname(__FILE__)."/006_error.tmp", "w");
51-
fclose($fp);
52-
var_dump( chmod(dirname(__FILE__)."/006_error.tmp") );
53-
var_dump( chmod("nofile") );
54-
var_dump( chmod() );
55-
var_dump( fileperms() );
56-
57-
/* With args greater than expected */
58-
var_dump( chmod(dirname(__FILE__)."/006_error.tmp", 0755, TRUE) );
59-
var_dump( fileperms(dirname(__FILE__)."/006_error.tmp", 0777) );
60-
var_dump( fileperms("nofile", 0777) );
61-
6249
echo "\n*** Done ***\n";
6350
?>
6451
--CLEAN--
@@ -83,25 +70,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d
8370
bool(false)
8471

8572

86-
Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
87-
NULL
88-
89-
Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
90-
NULL
91-
92-
Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d
93-
NULL
94-
95-
Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d
96-
NULL
97-
98-
Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
99-
NULL
100-
101-
Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
102-
NULL
103-
104-
Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
105-
NULL
106-
10773
*** Done ***

ext/standard/tests/file/006_variation2.phpt

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,23 @@ $perms_array = array(
6868
$count = 1;
6969
foreach($perms_array as $permission) {
7070
echo "-- Iteration $count --\n";
71-
var_dump( chmod($file_name, $permission) );
72-
printf("%o", fileperms($file_name) );
73-
echo "\n";
74-
clearstatcache();
75-
76-
var_dump( chmod($dir_name, $permission) );
77-
printf("%o", fileperms($dir_name) );
78-
echo "\n";
79-
clearstatcache();
71+
try {
72+
var_dump( chmod($file_name, $permission) );
73+
printf("%o", fileperms($file_name) );
74+
echo "\n";
75+
clearstatcache();
76+
} catch (TypeError $e) {
77+
echo $e->getMessage(), "\n";
78+
}
79+
80+
try {
81+
var_dump( chmod($dir_name, $permission) );
82+
printf("%o", fileperms($dir_name) );
83+
echo "\n";
84+
clearstatcache();
85+
} catch (TypeError $e) {
86+
echo $e->getMessage(), "\n";
87+
}
8088
$count++;
8189
}
8290
echo "*** Done ***\n";
@@ -148,39 +156,15 @@ bool(true)
148156
bool(true)
149157
43567
150158
-- Iteration 12 --
151-
152-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
153-
NULL
154-
103567
155-
156-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
157-
NULL
158-
43567
159+
chmod() expects parameter 2 to be int, string given
160+
chmod() expects parameter 2 to be int, string given
159161
-- Iteration 13 --
160-
161-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
162-
NULL
163-
103567
164-
165-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
166-
NULL
167-
43567
162+
chmod() expects parameter 2 to be int, string given
163+
chmod() expects parameter 2 to be int, string given
168164
-- Iteration 14 --
169-
170-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
171-
NULL
172-
103567
173-
174-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
175-
NULL
176-
43567
165+
chmod() expects parameter 2 to be int, string given
166+
chmod() expects parameter 2 to be int, string given
177167
-- Iteration 15 --
178-
179-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
180-
NULL
181-
103567
182-
183-
Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
184-
NULL
185-
43567
168+
chmod() expects parameter 2 to be int, string given
169+
chmod() expects parameter 2 to be int, string given
186170
*** Done ***

ext/standard/tests/file/007_error.phpt

Lines changed: 0 additions & 185 deletions
This file was deleted.

ext/standard/tests/file/basename.phpt

-1.34 KB
Binary file not shown.

0 commit comments

Comments
 (0)