text.lib.test.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. require_once(api_get_path(LIBRARY_PATH).'text.lib.php');
  3. class TestText extends UnitTestCase {
  4. function test_text_parse_glossary() {
  5. $input='';
  6. $res=_text_parse_glossary($input);
  7. $this->assertTrue(is_string($res));
  8. //var_dump($res);
  9. }
  10. function test_text_parse_tex() {
  11. $textext='';
  12. $res=_text_parse_tex($textext);
  13. $this->assertTrue(is_string($res));
  14. //var_dump($res);
  15. }
  16. function test_text_parse_texexplorer() {
  17. $textext='';
  18. $res=_text_parse_texexplorer($textext);
  19. $this->assertTrue(is_string($res));
  20. //var_dump($res);
  21. }
  22. function test_text_parse_tool() {
  23. $input='';
  24. $res=_text_parse_tool($input);
  25. $this->assertTrue(is_null($res));
  26. //var_dump($res);
  27. }
  28. function testcut() {
  29. $text='';
  30. $maxchar='';
  31. $res=cut($text,$maxchar,$embed=false);
  32. $this->assertTrue(is_string($res));
  33. //var_dump($res);
  34. }
  35. function testdate_to_str_ago() {
  36. $date='';
  37. $res=date_to_str_ago($date);
  38. $this->assertTrue(is_string($res));
  39. //var_dump($res);
  40. }
  41. function testfloat_format() {
  42. $number='';
  43. $res=float_format($number, $flag = 1);
  44. if(!is_numeric($res) or !is_float($res)) {
  45. $this->assertTrue(is_null($res));
  46. }
  47. //var_dump($res);
  48. }
  49. function testformat_locale_date() {
  50. $date_format='';
  51. $res=format_locale_date($date_format, $time_stamp = -1);
  52. $this->assertTrue(is_bool($res));
  53. //var_dump($res);
  54. }
  55. function testlatex_gif_renderer() {
  56. ob_start();
  57. $latex_code="";
  58. global $_course;
  59. $res=latex_gif_renderer($latex_code);
  60. ob_end_clean();
  61. $this->assertTrue(is_string($res));
  62. //var_dump($res);
  63. }
  64. function testmake_clickable() {
  65. $string='';
  66. $res=make_clickable($string);
  67. $this->assertTrue(is_string($res));
  68. //var_dump($res);
  69. }
  70. function testtext_filter() {
  71. $input='';
  72. $res=text_filter($input, $filter=true);
  73. $this->assertTrue(is_string($res));
  74. //var_dump($res);
  75. }
  76. }
  77. ?>