1--TEST--
2Test filetype() function: Variations
3--SKIPIF--
4<?php
5if (!function_exists("posix_mkfifo")) {
6    die("skip no posix_mkfifo()");
7}
8?>
9--FILE--
10<?php
11echo "*** Testing filetype() with various types ***\n";
12$file_path = __DIR__;
13$file1 = $file_path."/filetype1_variation.tmp";
14$file2 = $file_path."/filetype2_variation.tmp";
15$file3 = $file_path."/filetype3_variation.tmp";
16$link1 = $file_path."/filetype1_variation_link.tmp";
17$link2 = $file_path."/filetype2_variation_link.tmp";
18
19fclose( fopen($file1, "w") );
20fclose( fopen($file2, "w") );
21
22echo "-- Checking with files --\n";
23print( filetype($file1) )."\n";
24print( filetype($file2) )."\n";
25clearstatcache();
26
27echo "-- Checking with links: hardlink --\n";
28link( $file1, $link1);
29print( filetype($link1 ) )."\n";
30
31echo "-- Checking with links: symlink --\n";
32symlink( $file2, $link2);
33print( filetype($link2) )."\n";
34
35unlink($link1);
36unlink($link2);
37unlink($file1);
38unlink($file2);
39
40echo "-- Checking with directory --\n";
41mkdir("$file_path/filetype_variation");
42print( filetype("$file_path/filetype_variation") )."\n";
43rmdir( "$file_path/filetype_variation" );
44
45echo "-- Checking with fifo --\n";
46posix_mkfifo( $file3, 0755);
47print( filetype( $file3) )."\n";
48unlink($file3);
49
50/* Checking with block in file */
51/* To test this PEAR package should be installed */
52
53echo "\n*** Done ***\n";
54?>
55--EXPECT--
56*** Testing filetype() with various types ***
57-- Checking with files --
58file
59file
60-- Checking with links: hardlink --
61file
62-- Checking with links: symlink --
63link
64-- Checking with directory --
65dir
66-- Checking with fifo --
67fifo
68
69*** Done ***
70