blob: b66c7098bc30631f6625b3ee5b104185c8db0a87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
require_once 'lib/PicoFeed/PicoFeed.php';
use PicoFeed\Filter\Tag;
class TagFilterTest extends PHPUnit_Framework_TestCase
{
public function testAllowedTag()
{
$tag = new Tag;
$this->assertTrue($tag->isAllowed('p', array('class' => 'test')));
$this->assertTrue($tag->isAllowed('img', array('class' => 'test')));
$this->assertFalse($tag->isAllowed('script', array('class' => 'test')));
$this->assertFalse($tag->isAllowed('img', array('width' => '1', 'height' => '1')));
}
public function testHtml()
{
$tag = new Tag;
$this->assertEquals('<p>', $tag->openHtmlTag('p'));
$this->assertEquals('<img src="test" alt="truc"/>', $tag->openHtmlTag('img', 'src="test" alt="truc"'));
$this->assertEquals('<img/>', $tag->openHtmlTag('img'));
$this->assertEquals('<br/>', $tag->openHtmlTag('br'));
$this->assertEquals('</p>', $tag->closeHtmlTag('p'));
$this->assertEquals('', $tag->closeHtmlTag('img'));
$this->assertEquals('', $tag->closeHtmlTag('br'));
}
}
|