File: testHTML_Safe.php

package info (click to toggle)
php-html-safe 0.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 100 kB
  • ctags: 88
  • sloc: php: 327; xml: 66; makefile: 13; sh: 1
file content (29 lines) | stat: -rw-r--r-- 838 bytes parent folder | download | duplicates (2)
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
<?php
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'HTML/Safe.php';

class testHTML_Safe extends PHPUnit_Framework_TestCase
{
    public function testAllowTags()
    {
        $input    = '<html><body><p>my text</p></body></html>'; 
        $expected = '<body><p>my text</p></body>';

        $safe = new HTML_Safe;
        $safe->setAllowTags(array('body'));
        $this->assertSame($expected, $safe->parse($input)); 
    }

    public function testSpecialChars()
    {
        $inputOne    = 'a+b-c';
        $expectedOne = 'a+b-c';

        $inputTwo    = '+49-52 <br />';
        $expectedTwo = '+49-52 <br />';

        $safe = new HTML_Safe;
//        $this->assertSame($expectedOne, $safe->parse($inputOne));
//        $this->assertSame($expectedTwo, $safe->parse($inputTwo));
    }
}