added skipif for root

This commit is contained in:
Zoe Slattery 2009-03-20 09:09:34 +00:00
parent 92f17edda7
commit ec3ee30a75
5 changed files with 55 additions and 0 deletions

View file

@ -5,6 +5,17 @@ Test is_executable() function: usage variations - file/dir with diff. perms
if (substr(PHP_OS, 0, 3) == 'WIN') { if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip not for windows'); die('skip not for windows');
} }
// Skip if being run by root
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
die('skip cannot be run as root');
}
unlink($filename);
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -5,6 +5,17 @@ Test is_readable() function: usage variations - file/dir with diff. perms
if (substr(PHP_OS, 0, 3) == 'WIN') { if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip not for windows'); die('skip not for windows');
} }
// Skip if being run by root
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
die('skip cannot be run as root');
}
unlink($filename);
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -5,6 +5,17 @@ Test is_writable() and its alias is_writeable() function: usage variations - fil
if (substr(PHP_OS, 0, 3) == 'WIN') { if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. only on LINUX'); die('skip.. only on LINUX');
} }
// Skip if being run by root
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
die('skip cannot be run as root');
}
unlink($filename);
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -4,6 +4,17 @@ Test lchown() function : error functionality
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support'); if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
if (!function_exists("posix_getuid")) die("skip no posix_getuid()"); if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
// Skip if being run by root
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
die('skip cannot be run as root');
}
unlink($filename);
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -5,6 +5,17 @@ Test tempnam() function: usage variations - permissions(0000 to 0777) of dir
if (substr(PHP_OS, 0, 3) == 'WIN') { if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for Windows'); die('skip Not valid for Windows');
} }
// Skip if being run by root
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
die('skip cannot be run as root');
}
unlink($filename);
?> ?>
--FILE-- --FILE--
<?php <?php