LangTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. class HTMLPurifier_AttrTransform_LangTest
  3. extends HTMLPurifier_AttrTransformHarness
  4. {
  5. function setUp() {
  6. parent::setUp();
  7. $this->obj = new HTMLPurifier_AttrTransform_Lang();
  8. }
  9. function testEmptyInput() {
  10. $this->assertResult(array());
  11. }
  12. function testCopyLangToXMLLang() {
  13. $this->assertResult(
  14. array('lang' => 'en'),
  15. array('lang' => 'en', 'xml:lang' => 'en')
  16. );
  17. }
  18. function testPreserveAttributes() {
  19. $this->assertResult(
  20. array('src' => 'vert.png', 'lang' => 'fr'),
  21. array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr')
  22. );
  23. }
  24. function testCopyXMLLangToLang() {
  25. $this->assertResult(
  26. array('xml:lang' => 'en'),
  27. array('xml:lang' => 'en', 'lang' => 'en')
  28. );
  29. }
  30. function testXMLLangOverridesLang() {
  31. $this->assertResult(
  32. array('lang' => 'fr', 'xml:lang' => 'de'),
  33. array('lang' => 'de', 'xml:lang' => 'de')
  34. );
  35. }
  36. }
  37. // vim: et sw=4 sts=4