File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ class ImagesBlacklistTest extends PHPUnit_Framework_TestCase
3
+ {
4
+ public function testPlainText ()
5
+ {
6
+ $ info = Embed \Embed::create ('http://www.lopinion.fr/24-mars-2015/cartes-chance-sont-epuisees-22609 ' , [
7
+ 'adapter ' => [
8
+ 'config ' => [
9
+ 'imagesBlacklist ' => [
10
+ 'http://www.lopinion.fr/sites/nb.com/files/2015/01/logo-o-default_0.png?p ' ,
11
+ ],
12
+ ]
13
+ ],
14
+ 'providers ' => [
15
+ 'html ' => [
16
+ 'maxImages ' => 0
17
+ ]
18
+ ]
19
+ ]);
20
+
21
+ $ this ->assertNull ($ info ->image );
22
+ }
23
+
24
+ public function testPlainUrlMatch ()
25
+ {
26
+ $ info = Embed \Embed::create ('http://www.lopinion.fr/24-mars-2015/cartes-chance-sont-epuisees-22609 ' , [
27
+ 'adapter ' => [
28
+ 'config ' => [
29
+ 'imagesBlacklist ' => [
30
+ '*/logo-o-default_0.png* ' ,
31
+ ],
32
+ ]
33
+ ],
34
+ 'providers ' => [
35
+ 'html ' => [
36
+ 'maxImages ' => 0
37
+ ]
38
+ ]
39
+ ]);
40
+
41
+ $ this ->assertNull ($ info ->image );
42
+ }
43
+
44
+ public function testAuthorizedImage ()
45
+ {
46
+ $ info = Embed \Embed::create ('http://www.lopinion.fr/24-mars-2015/jeunes-restent-angle-mort-politiques-publiques-22607 ' , [
47
+ 'adapter ' => [
48
+ 'config ' => [
49
+ 'imagesBlacklist ' => [
50
+ '*/logo-o-default_0.png* ' ,
51
+ ],
52
+ ]
53
+ ],
54
+ 'providers ' => [
55
+ 'html ' => [
56
+ 'maxImages ' => 0
57
+ ]
58
+ ]
59
+ ]);
60
+
61
+ $ this ->assertNotNull ($ info ->image );
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments