File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
file /
lstat_stat_variation20.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test lstat() and stat() functions: usage variations - link names stored in array/object
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. lstat() not available on Windows');
}
?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
Description: Gives information about a file or symbolic link
Prototype: array stat ( string $filename );
Description: Gives information about a file
*/
/* test for stats of link when their names are stored in object and array */
$file_path = dirname(__FILE__);
require "$file_path/file.inc";
$fp = fopen("$file_path/lstat_stat_variation20.tmp", "w"); // temp file
fclose($fp);
// temp link
symlink("$file_path/lstat_stat_variation20.tmp", "$file_path/lstat_stat_variation20_link.tmp");
echo "*** Testing lstat() with linkname stored inside an object/array ***\n";
class names {
public $var_name;
public function names($name) {
$this->var_name = $name;
}
}
// link name stored in an object
$link_object = new names("$file_path/lstat_stat_variation20_link.tmp");
// link name stored in side an array
// with default numeric key
$link_array = array("$file_path/lstat_stat_variation20_link.tmp");
// with string key index
$link_array_with_key = array("linkname" => "$file_path/lstat_stat_variation20_link.tmp");
echo "\n-- Testing lstat() on link name stored inside an object --\n";
var_dump( lstat($link_object->var_name) );
echo "\n-- Testing stat() on link name stored inside an array --\n";
var_dump( stat($link_array[0]) ); // with default numeric index
var_dump( stat($link_array_with_key["linkname"]) ); // with string key
var_dump( stat($link_array_with_key['linkname']) );
echo "\n--- Done ---";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
unlink("$file_path/lstat_stat_variation20_link.tmp");
unlink("$file_path/lstat_stat_variation20.tmp");
?>
--EXPECTF--
*** Testing lstat() with linkname stored inside an object/array ***
-- Testing lstat() on link name stored inside an object --
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)
}
-- Testing stat() on link name stored inside an array --
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)
}
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)
}
--- Done ---
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>