stat_variation7-win32.phpt 4.1 KB

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