Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / tests / HTMLPurifier / AttrTransform / LangTest.php
blob42232ca3772d072e1584565f3e8c4cbef0215419
1 <?php
3 require_once 'HTMLPurifier/Token.php';
4 require_once 'HTMLPurifier/AttrTransformHarness.php';
5 require_once 'HTMLPurifier/AttrTransform/Lang.php';
7 class HTMLPurifier_AttrTransform_LangTest
8 extends HTMLPurifier_AttrTransformHarness
11 function setUp() {
12 parent::setUp();
13 $this->obj = new HTMLPurifier_AttrTransform_Lang();
16 function test() {
18 // leave non-lang'ed elements alone
19 $this->assertResult(array(), true);
21 // copy lang to xml:lang
22 $this->assertResult(
23 array('lang' => 'en'),
24 array('lang' => 'en', 'xml:lang' => 'en')
27 // preserve attributes
28 $this->assertResult(
29 array('src' => 'vert.png', 'lang' => 'fr'),
30 array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr')
33 // copy xml:lang to lang
34 $this->assertResult(
35 array('xml:lang' => 'en'),
36 array('xml:lang' => 'en', 'lang' => 'en')
39 // both set, override lang with xml:lang
40 $this->assertResult(
41 array('lang' => 'fr', 'xml:lang' => 'de'),
42 array('lang' => 'de', 'xml:lang' => 'de')