2006-08-05 01:50:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/Token.php';
|
2006-08-05 02:16:28 +00:00
|
|
|
require_once 'HTMLPurifier/AttrTransformHarness.php';
|
2006-08-05 01:50:13 +00:00
|
|
|
require_once 'HTMLPurifier/AttrTransform/Lang.php';
|
|
|
|
|
2006-08-05 02:16:28 +00:00
|
|
|
class HTMLPurifier_AttrTransform_LangTest
|
|
|
|
extends HTMLPurifier_AttrTransformHarness
|
2006-08-05 01:50:13 +00:00
|
|
|
{
|
|
|
|
|
2006-10-22 03:38:32 +00:00
|
|
|
function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_AttrTransform_Lang();
|
|
|
|
}
|
|
|
|
|
2007-08-06 06:22:23 +00:00
|
|
|
function testEmptyInput() {
|
|
|
|
$this->assertResult(array());
|
|
|
|
}
|
|
|
|
|
|
|
|
function testCopyLangToXMLLang() {
|
2006-10-22 03:38:32 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('lang' => 'en'),
|
|
|
|
array('lang' => 'en', 'xml:lang' => 'en')
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testPreserveAttributes() {
|
2006-10-22 03:38:32 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('src' => 'vert.png', 'lang' => 'fr'),
|
|
|
|
array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr')
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testCopyXMLLangToLang() {
|
2006-10-22 03:38:32 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('xml:lang' => 'en'),
|
2007-05-05 20:17:04 +00:00
|
|
|
array('xml:lang' => 'en', 'lang' => 'en')
|
2006-10-22 03:38:32 +00:00
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testXMLLangOverridesLang() {
|
2006-10-22 03:38:32 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('lang' => 'fr', 'xml:lang' => 'de'),
|
|
|
|
array('lang' => 'de', 'xml:lang' => 'de')
|
|
|
|
);
|
2006-08-05 01:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|