stat_variation7-win32.phpt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. --TEST--
  2. Test stat() functions: usage variations - names of dir/file stored in objects
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die('skip.. only for Windows');
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /*
  12. * Prototype: array stat ( string $filename );
  13. * Description: Gives information about a file
  14. */
  15. /* test the stats of dir/file when their names are stored in objects */
  16. $file_path = dirname(__FILE__);
  17. require "$file_path/file.inc";
  18. /* create temp file and directory */
  19. mkdir("$file_path/stat_variation7/"); // temp dir
  20. $file_handle = fopen("$file_path/stat_variation7.tmp", "w"); // temp file
  21. fclose($file_handle);
  22. echo "\n*** Testing stat(): with filename
  23. and directory name stored inside a object ***\n";
  24. // creating object with members as numeric and non-numeric filename and directory name
  25. class object_temp {
  26. public $var_name;
  27. public function object_temp($name) {
  28. $this->var_name = $name;
  29. }
  30. }
  31. // directory as member
  32. $obj1 = new object_temp("$file_path/stat_variation7/");
  33. $obj2 = new object_temp("$file_path/stat_variation7a/");
  34. // file as member
  35. $obj3 = new object_temp("$file_path/stat_variation7.tmp");
  36. $obj4 = new object_temp("$file_path/stat_variation7a.tmp");
  37. echo "\n-- Testing stat() on filename stored inside an object --\n";
  38. var_dump( stat($obj3->var_name) );
  39. $file_handle = fopen("$file_path/stat_variation7a.tmp", "w");
  40. fclose($file_handle);
  41. var_dump( stat($obj4->var_name) );
  42. echo "\n-- Testing stat() on directory name stored inside an object --\n";
  43. var_dump( stat($obj1->var_name) );
  44. mkdir("$file_path/stat_variation7a/");
  45. var_dump( stat($obj2->var_name) );
  46. echo "\n*** Done ***";
  47. ?>
  48. --CLEAN--
  49. <?php
  50. $file_path = dirname(__FILE__);
  51. unlink("$file_path/stat_variation7.tmp");
  52. unlink("$file_path/stat_variation7a.tmp");
  53. rmdir("$file_path/stat_variation7");
  54. rmdir("$file_path/stat_variation7a");
  55. ?>
  56. --EXPECTF--
  57. *** Testing stat(): with filename
  58. and directory name stored inside a object ***
  59. -- Testing stat() on filename stored inside an object --
  60. array(26) {
  61. [0]=>
  62. int(%d)
  63. [1]=>
  64. int(%d)
  65. [2]=>
  66. int(%d)
  67. [3]=>
  68. int(%d)
  69. [4]=>
  70. int(%d)
  71. [5]=>
  72. int(%d)
  73. [6]=>
  74. int(%d)
  75. [7]=>
  76. int(%d)
  77. [8]=>
  78. int(%d)
  79. [9]=>
  80. int(%d)
  81. [10]=>
  82. int(%d)
  83. [11]=>
  84. int(-%d)
  85. [12]=>
  86. int(-%d)
  87. ["dev"]=>
  88. int(%d)
  89. ["ino"]=>
  90. int(%d)
  91. ["mode"]=>
  92. int(%d)
  93. ["nlink"]=>
  94. int(%d)
  95. ["uid"]=>
  96. int(%d)
  97. ["gid"]=>
  98. int(%d)
  99. ["rdev"]=>
  100. int(%d)
  101. ["size"]=>
  102. int(%d)
  103. ["atime"]=>
  104. int(%d)
  105. ["mtime"]=>
  106. int(%d)
  107. ["ctime"]=>
  108. int(%d)
  109. ["blksize"]=>
  110. int(-%d)
  111. ["blocks"]=>
  112. int(-%d)
  113. }
  114. array(26) {
  115. [0]=>
  116. int(%d)
  117. [1]=>
  118. int(%d)
  119. [2]=>
  120. int(%d)
  121. [3]=>
  122. int(%d)
  123. [4]=>
  124. int(%d)
  125. [5]=>
  126. int(%d)
  127. [6]=>
  128. int(%d)
  129. [7]=>
  130. int(%d)
  131. [8]=>
  132. int(%d)
  133. [9]=>
  134. int(%d)
  135. [10]=>
  136. int(%d)
  137. [11]=>
  138. int(-%d)
  139. [12]=>
  140. int(-%d)
  141. ["dev"]=>
  142. int(%d)
  143. ["ino"]=>
  144. int(%d)
  145. ["mode"]=>
  146. int(%d)
  147. ["nlink"]=>
  148. int(%d)
  149. ["uid"]=>
  150. int(%d)
  151. ["gid"]=>
  152. int(%d)
  153. ["rdev"]=>
  154. int(%d)
  155. ["size"]=>
  156. int(%d)
  157. ["atime"]=>
  158. int(%d)
  159. ["mtime"]=>
  160. int(%d)
  161. ["ctime"]=>
  162. int(%d)
  163. ["blksize"]=>
  164. int(-%d)
  165. ["blocks"]=>
  166. int(-%d)
  167. }
  168. -- Testing stat() on directory name stored inside an object --
  169. array(26) {
  170. [0]=>
  171. int(%d)
  172. [1]=>
  173. int(%d)
  174. [2]=>
  175. int(%d)
  176. [3]=>
  177. int(%d)
  178. [4]=>
  179. int(%d)
  180. [5]=>
  181. int(%d)
  182. [6]=>
  183. int(%d)
  184. [7]=>
  185. int(%d)
  186. [8]=>
  187. int(%d)
  188. [9]=>
  189. int(%d)
  190. [10]=>
  191. int(%d)
  192. [11]=>
  193. int(-%d)
  194. [12]=>
  195. int(-%d)
  196. ["dev"]=>
  197. int(%d)
  198. ["ino"]=>
  199. int(%d)
  200. ["mode"]=>
  201. int(%d)
  202. ["nlink"]=>
  203. int(%d)
  204. ["uid"]=>
  205. int(%d)
  206. ["gid"]=>
  207. int(%d)
  208. ["rdev"]=>
  209. int(%d)
  210. ["size"]=>
  211. int(%d)
  212. ["atime"]=>
  213. int(%d)
  214. ["mtime"]=>
  215. int(%d)
  216. ["ctime"]=>
  217. int(%d)
  218. ["blksize"]=>
  219. int(-%d)
  220. ["blocks"]=>
  221. int(-%d)
  222. }
  223. array(26) {
  224. [0]=>
  225. int(%d)
  226. [1]=>
  227. int(%d)
  228. [2]=>
  229. int(%d)
  230. [3]=>
  231. int(%d)
  232. [4]=>
  233. int(%d)
  234. [5]=>
  235. int(%d)
  236. [6]=>
  237. int(%d)
  238. [7]=>
  239. int(%d)
  240. [8]=>
  241. int(%d)
  242. [9]=>
  243. int(%d)
  244. [10]=>
  245. int(%d)
  246. [11]=>
  247. int(-%d)
  248. [12]=>
  249. int(-%d)
  250. ["dev"]=>
  251. int(%d)
  252. ["ino"]=>
  253. int(%d)
  254. ["mode"]=>
  255. int(%d)
  256. ["nlink"]=>
  257. int(%d)
  258. ["uid"]=>
  259. int(%d)
  260. ["gid"]=>
  261. int(%d)
  262. ["rdev"]=>
  263. int(%d)
  264. ["size"]=>
  265. int(%d)
  266. ["atime"]=>
  267. int(%d)
  268. ["mtime"]=>
  269. int(%d)
  270. ["ctime"]=>
  271. int(%d)
  272. ["blksize"]=>
  273. int(-%d)
  274. ["blocks"]=>
  275. int(-%d)
  276. }
  277. *** Done ***