You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1KB

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