exercise_import.inc.test.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. //Is possible than this functions still are not implemented int he Chamilo systems or some are deprecated
  3. class TestExerciseImport extends UnitTestCase {
  4. function testelementData() {
  5. global $element_pile;
  6. $element_pile = array();
  7. $parser= array();
  8. $data = array();
  9. $res = elementData($parser,$data);
  10. $this->assertFalse(is_array($res));
  11. if(!is_null){
  12. $this->assertTrue($res);
  13. }
  14. //var_dump($res);
  15. }
  16. function testendElement() {
  17. global $element_pile;
  18. $element_pile = array();
  19. $parser= array();
  20. $data = array();
  21. $res = endElement($parser,$data);
  22. $this->assertFalse(is_array($res));
  23. if(!is_null){
  24. $this->assertTrue($res);
  25. }
  26. //var_dump($res);
  27. }
  28. /**
  29. * possible deprecated
  30. * @return the path of the temporary directory where the exercise was uploaded and unzipped
  31. */
  32. /*function testgetandunzipuploadedexercise() {
  33. include_once (realpath(dirname(__FILE__) . '/../../inc/lib/pclzip/') . '/pclzip.lib.php');
  34. $res = get_and_unzip_uploaded_exercise();
  35. $this->assertFalse(is_array($res));
  36. if(!is_null){
  37. $this->assertTrue($res);
  38. }
  39. //var_dump($res);
  40. } */
  41. /**
  42. * main function to import an exercise,
  43. * Possible deprecated
  44. * @return an array as a backlog of what was really imported, and error or debug messages to display
  45. */
  46. /*function testimport_exercise() {
  47. $file = '';
  48. $res = import_exercise($file);
  49. $this->assertFalse(is_array($res));
  50. if(!is_null){
  51. $this->assertTrue($res);
  52. }
  53. var_dump($res);
  54. }*/
  55. function testparse_file() {
  56. $file = '';
  57. $exercisePath = '';
  58. $questionFile = '';
  59. $res = qti_parse_file($exercisePath, $file, $questionFile);
  60. $this->assertTrue(is_array($res));
  61. if(!is_null){
  62. $this->assertTrue($res);
  63. }
  64. //var_dump($res);
  65. }
  66. function teststartElement() {
  67. $parser = 'test';
  68. $name = 'test';
  69. $attributes = array();
  70. $res = startElement($parser, $name, $attributes);
  71. $this->assertFalse(is_array($res));
  72. if(!is_null){
  73. $this->assertTrue($res);
  74. }
  75. //var_dump($res);
  76. }
  77. }
  78. ?>