2006-08-05 01:50:13 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-05 02:16:28 +00:00
|
|
|
class HTMLPurifier_AttrTransform_LangTest
|
|
|
|
extends HTMLPurifier_AttrTransformHarness
|
2006-08-05 01:50:13 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2006-10-22 03:38:32 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_AttrTransform_Lang();
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testEmptyInput()
|
|
|
|
{
|
2007-08-06 06:22:23 +00:00
|
|
|
$this->assertResult(array());
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public 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
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public 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
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public 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
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public 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
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-05 01:50:13 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|