Skip to content

Commit ed61e55

Browse files
committed
imagesBlacklist tests
1 parent 113b4a0 commit ed61e55

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/ImagesBlacklistTest.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
}

0 commit comments

Comments
 (0)