Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove duplicate test conditions
  • Loading branch information
Girgias committed Aug 23, 2024
commit 1c33031a48a374c17e90b2e0edab1bbbddf62935
43 changes: 14 additions & 29 deletions ext/standard/tests/file/readlink_realpath_variation3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,34 @@ Test readlink() and realpath() functions: usage variation - invalid args
<?php
echo "*** Testing readlink() and realpath() : usage variations ***\n";

echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n";
$link_string = array (
/* linkname as spaces */
" ",
' ',
echo "\n*** Testing readlink() and realpath() with link name as empty string, NULL and single space ***\n";

/* empty linkname */
"",
'',
);
for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
echo "-- Iteration";
echo $loop_counter + 1;
echo " --\n";
echo 'readlink with link as spaces', PHP_EOL;
var_dump(readlink(' '));
echo 'realpath with link as spaces', PHP_EOL;
var_dump(realpath(' '));

var_dump( readlink($link_string[$loop_counter]) );
var_dump( realpath($link_string[$loop_counter]) );
}
echo 'readlink with link as empty string', PHP_EOL;
var_dump(readlink(''));
echo 'realpath with link as empty string', PHP_EOL;
var_dump(realpath(''));

echo "Done\n";
?>
--EXPECTF--
*** Testing readlink() and realpath() : usage variations ***

*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***
-- Iteration1 --
*** Testing readlink() and realpath() with link name as empty string, NULL and single space ***
readlink with link as spaces

Warning: readlink(): %s in %s on line %d
bool(false)
%s
-- Iteration2 --

Warning: readlink(): %s in %s on line %d
bool(false)
%s
-- Iteration3 --

Warning: readlink(): %s in %s on line %d
realpath with link as spaces
bool(false)
string(%d) "%s"
-- Iteration4 --
readlink with link as empty string

Warning: readlink(): %s in %s on line %d
bool(false)
realpath with link as empty string
string(%d) "%s"
Done