|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Sonata Project package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Sonata\MediaBundle\Tests\Provider; |
|
15
|
|
|
|
|
16
|
|
|
class FakeHttpWrapper |
|
17
|
|
|
{ |
|
18
|
|
|
public static $ref = [ |
|
19
|
|
|
// youtube content |
|
20
|
|
|
'http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=BDYAbAtaDzA&format=json' => 'valide_youtube.txt', |
|
21
|
|
|
'http://i3.ytimg.com/vi/BDYAbAtaDzA/hqdefault.jpg' => 'logo.jpg', |
|
22
|
|
|
|
|
23
|
|
|
// dailymotion content |
|
24
|
|
|
'http://www.dailymotion.com/services/oembed?url=http://www.dailymotion.com/video/x9wjql&format=json' => 'valide_dailymotion.txt', |
|
25
|
|
|
'http://ak2.static.dailymotion.com/static/video/711/536/16635117:jpeg_preview_large.jpg?20100801072241' => 'logo.jpg', |
|
26
|
|
|
|
|
27
|
|
|
// vimeo content |
|
28
|
|
|
'http://vimeo.com/api/oembed.json?url=http://vimeo.com/BDYAbAtaDzA' => 'valide_vimeo.txt', |
|
29
|
|
|
'http://b.vimeocdn.com/ts/136/375/136375440_1280.jpg' => 'logo.jpg', |
|
30
|
|
|
]; |
|
31
|
|
|
|
|
32
|
|
|
/* Properties */ |
|
33
|
|
|
public $context; |
|
34
|
|
|
|
|
35
|
|
|
public $fp; |
|
36
|
|
|
|
|
37
|
|
|
/* Methods */ |
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function dir_closedir(): void |
|
43
|
|
|
{ |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function dir_opendir($path, $options): void |
|
|
|
|
|
|
47
|
|
|
{ |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function dir_readdir(): void |
|
51
|
|
|
{ |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function dir_rewinddir(): void |
|
55
|
|
|
{ |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function mkdir($path, $mode, $options): void |
|
|
|
|
|
|
59
|
|
|
{ |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function rename($path_from, $path_to): void |
|
|
|
|
|
|
63
|
|
|
{ |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function rmdir($path, $options): void |
|
|
|
|
|
|
67
|
|
|
{ |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function stream_cast($cast_as): void |
|
|
|
|
|
|
71
|
|
|
{ |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function stream_close(): bool |
|
75
|
|
|
{ |
|
76
|
|
|
return true; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function stream_eof(): bool |
|
80
|
|
|
{ |
|
81
|
|
|
return 0 === feof($this->fp); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function stream_flush(): void |
|
85
|
|
|
{ |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function stream_lock($operation): void |
|
|
|
|
|
|
89
|
|
|
{ |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function stream_open($path, $mode, $options, &$opened_path): bool |
|
|
|
|
|
|
93
|
|
|
{ |
|
94
|
|
|
$file = __DIR__.'/../fixtures/'.self::$ref[$path]; |
|
95
|
|
|
|
|
96
|
|
|
if (!is_file($file)) { |
|
97
|
|
|
var_dump('unable to retrieve the file : '.$file); |
|
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
$this->fp = fopen($file, $mode); |
|
101
|
|
|
|
|
102
|
|
|
return true; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function stream_read($count) |
|
106
|
|
|
{ |
|
107
|
|
|
return fread($this->fp, $count); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function stream_seek($offset, $whence = SEEK_SET): void |
|
|
|
|
|
|
111
|
|
|
{ |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function stream_set_option($option, $arg1, $arg2): void |
|
|
|
|
|
|
115
|
|
|
{ |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
public function stream_stat(): void |
|
119
|
|
|
{ |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function stream_tell(): void |
|
123
|
|
|
{ |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
public function stream_write($data): void |
|
|
|
|
|
|
127
|
|
|
{ |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function unlink($path): void |
|
|
|
|
|
|
131
|
|
|
{ |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function url_stat($path, $flags): void |
|
|
|
|
|
|
135
|
|
|
{ |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.