Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / standard / tests / streams / bug40459.phpt
blob8ee4363ed93bba4fadda5d3e07877cc6768109a8
1 --TEST--
2 bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called
3 --FILE--
4 <?php
5 // Test whether the constructor of the user-space stream wrapper is called when stream functions are called
6 class testwrapper {
7         private $constructorCalled = false;
8         function __construct() {
9                 $this->constructorCalled = true;
10         }
12         function stream_open($path, $mode, $options, &$opened_path)
13         {
14                 echo $this->constructorCalled ? 'yes' : 'no';
15                 return true;
16         }
18         function url_stat($url, $flags)
19         {
20                 echo $this->constructorCalled ? 'yes' : 'no';
21                 return array();
22         }
24         function unlink($url)
25         {
26                 echo $this->constructorCalled ? 'yes' : 'no';
27         }
29         function rename($from, $to)
30         {
31                 echo $this->constructorCalled ? 'yes' : 'no';
32         }
34         function mkdir($dir, $mode, $options)
35         {
36                 echo $this->constructorCalled ? 'yes' : 'no';
37         }
39         function rmdir($dir, $options)
40         {
41                 echo $this->constructorCalled ? 'yes' : 'no';
42         }
44         function dir_opendir($url, $options)
45         {
46                 echo $this->constructorCalled ? 'yes' : 'no';
47                 return TRUE;
48         }
49         function stream_metadata() 
50         {
51                 echo $this->constructorCalled ? 'yes' : 'no';
52                 return TRUE;
53         }
56 stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL);
58 echo 'stream_open: ';
59 fopen('test://test', 'r');
60 echo "\n";
62 echo 'url_stat: ';
63 stat('test://test');
64 echo "\n";
66 echo 'dir_opendir: ';
67 opendir('test://test');
68 echo "\n";
70 echo 'rmdir: ';
71 rmdir('test://test');
72 echo "\n";
74 echo 'mkdir: ';
75 mkdir('test://test');
76 echo "\n";
78 echo 'rename: ';
79 rename('test://test', 'test://test2');
80 echo "\n";
82 echo 'unlink: ';
83 unlink('test://test');
84 echo "\n";
86 echo 'touch: ';
87 touch('test://test', time());
88 echo "\n";
93 ==DONE==
94 --EXPECT--
95 stream_open: yes
96 url_stat: yes
97 dir_opendir: yes
98 rmdir: yes
99 mkdir: yes
100 rename: yes
101 unlink: yes
102 touch: yes
103 ==DONE==