forumthreadlink.class.test.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. class TestForumThreadLink extends UnitTestCase {
  3. public function TestForumThreadLink() {
  4. $this->UnitTestCase('Test Forum Thread Link');
  5. }
  6. public function __construct() {
  7. $this->UnitTestCase('Gradebook forum library - main/gradebook/lib/be/forumthreadlink.class.test.php');
  8. // The constructor acts like a global setUp for the class
  9. TestManager::create_test_course('COURSEFORUMTHREAD');
  10. $this->forumthreadlink = new ForumThreadLink();
  11. $this->forumthreadlink->set_id(1);
  12. $this->forumthreadlink->set_type(5);
  13. $this->forumthreadlink->set_ref_id(1);
  14. $this->forumthreadlink->set_user_id(1);
  15. $this->forumthreadlink->set_course_code('COURSEFORUMTHREAD');
  16. $this->forumthreadlink->set_category_id(1);
  17. $this->forumthreadlink->set_date(date);
  18. $this->forumthreadlink->set_weight(1);
  19. $this->forumthreadlink->set_visible('visible');
  20. }
  21. public function testcalc_score() {
  22. $res = $this->forumthreadlink->calc_score(null);
  23. $this->assertNull($res);
  24. //var_dump($res);
  25. $res2 = $this->forumthreadlink->calc_score(1);
  26. $this->assertTrue(is_array($res2));
  27. //var_dump($res2);
  28. }
  29. public function __destruct() {
  30. // The destructor acts like a global tearDown for the class
  31. TestManager::delete_test_course('COURSEFORUMTHREAD');
  32. }
  33. }
  34. ?>