xht.lib.test.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. class TestXht extends UnitTestCase {
  3. public $xhtdoc;
  4. public function TestXht(){
  5. $this->UnitTestCase('test the library that define xht_htmlwchars & class xhtdoc with methods');
  6. }
  7. public function setUp(){
  8. $this->xhtdoc = new xhtdoc();
  9. }
  10. public function tearDown(){
  11. $this->xhtdoc = null;
  12. }
  13. public function testXhtHtmlwchars(){
  14. global $charset;
  15. $s='';
  16. $res = xht_htmlwchars($s);
  17. $this->assertTrue(is_string($res));
  18. //var_dump($res);
  19. }
  20. public function testXhtIsAssoclist(){
  21. $s ='';
  22. $res = xht_is_assoclist($s);
  23. $this->assertTrue(is_bool($res));
  24. $this->assertTrue($res === true || $res === false);
  25. //var_dump($res);
  26. }
  27. public function testXhtExplodeAssoclist(){
  28. $S =array(aaasasa);
  29. $res = xht_explode_assoclist($S);
  30. if(is_array($res))
  31. $this->assertTrue(is_array($res));
  32. else
  33. $this->assertFalse(is_array($res));
  34. //var_dump($res);
  35. }
  36. public function testXhtFillTemplate(){
  37. $template_name=null;
  38. $cur_elem = 0;
  39. $res = xhtdoc::xht_fill_template($template_name, $cur_elem);
  40. $this->assertTrue(is_string($res));
  41. //var_dump($res);
  42. }
  43. public function testxhtSubstitute(){
  44. global $charset;
  45. $subtext='';
  46. $cur_elem = 0;
  47. $pre = '';
  48. $post = '';
  49. $res = xhtdoc::xht_substitute($subtext, $cur_elem = 0, $pre = '', $post = '');
  50. $this->assertTrue(is_string($res));
  51. //var_dump($res);
  52. }
  53. public function testXhtAddTemplate(){
  54. $template_name='';
  55. $httext='';
  56. $res = xhtdoc::xht_add_template($template_name, $httext);
  57. $this->assertTrue(is_null($res));
  58. //var_dump($res);
  59. }
  60. public function testXhtdoc(){
  61. $htt_file_contents='document';
  62. $res = xhtdoc::xhtdoc($htt_file_contents);
  63. $this->assertTrue(is_null($res));
  64. //var_dump($res);
  65. }
  66. public function testShowParam(){
  67. global $charset;
  68. $result = '';
  69. $res = xhtdoc::_show_param();
  70. $this->assertTrue(is_string($res));
  71. //var_dump($res);
  72. }
  73. }
  74. ?>