1 | <?php |
||
9 | class MockHttpStreamWrapper { |
||
10 | |||
11 | public static $mockBodyData = ''; |
||
12 | public static $mockResponseCode = 'HTTP/1.1 200 OK'; |
||
13 | |||
14 | public $context; |
||
15 | public $position = 0; |
||
16 | public $bodyData = 'test data'; |
||
17 | public $responseCode = ''; |
||
18 | |||
19 | protected $streamArray = array(); |
||
20 | protected $options = array(); |
||
21 | protected $isOpen = false; |
||
22 | |||
23 | /** |
||
24 | * StreamWrapper::stream_open |
||
25 | */ |
||
26 | public function stream_open( $path, $mode, $options, &$opened_path ) { |
||
27 | $this->bodyData = self::$mockBodyData; |
||
28 | $this->responseCode = self::$mockResponseCode; |
||
29 | array_push( $this->streamArray, self::$mockResponseCode ); |
||
30 | $this->isOpen = true; |
||
31 | return true; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * StreamWrapper::stream_write |
||
36 | */ |
||
37 | public function stream_write( $data ) { |
||
38 | |||
39 | if ( $this->isOpen ) { |
||
40 | return strlen( $data ); |
||
41 | } |
||
42 | |||
43 | return 0; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * StreamWrapper::stream_read |
||
48 | */ |
||
49 | public function stream_read( $count ) { |
||
59 | |||
60 | /** |
||
61 | * StreamWrapper::stream_eof |
||
62 | */ |
||
63 | public function stream_eof() { |
||
66 | |||
67 | /** |
||
68 | * StreamWrapper::stream_set_option |
||
69 | */ |
||
70 | public function stream_set_option( $option, $arg1, $arg2 ) { |
||
73 | |||
74 | /** |
||
75 | * StreamWrapper::stream_stat |
||
76 | */ |
||
77 | public function stream_stat() { |
||
80 | |||
81 | /** |
||
82 | * StreamWrapper::stream_tell |
||
83 | */ |
||
84 | public function stream_tell() { |
||
87 | |||
88 | } |
||
89 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.