123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- class TestExerciseLink extends UnitTestCase {
- public function TestExerciseLink() {
- $this->UnitTestCase('Test Exercise Link');
- }
- public function __construct() {
- $this->UnitTestCase('Gradebook exercises library - main/gradebook/lib/be/exerciselink.class.test.php');
- global $date;
-
- TestManager::create_test_course('COURSEEXERCISELINK');
- $this->exerciselink = new ExerciseLink();
- $this->exerciselink-> set_id (1);
- $this->exerciselink-> set_name ('test');
- $this->exerciselink-> set_description ('test description');
- $this->exerciselink-> set_user_id (1);
- $this->exerciselink-> set_course_code ('COURSEEXERCISELINK');
- $this->exerciselink-> set_category_id (1);
- $this->exerciselink-> set_date ($date);
- $this->exerciselink-> set_weight (1);
- $this->exerciselink-> set_max (1);
- $this->exerciselink-> set_visible (1);
- }
-
- public function testget_all_links() {
- $res = $this->exerciselink->get_all_links();
- $this->assertTrue(is_array($res));
-
- }
-
- public function testcalc_score() {
- $res = $this->exerciselink->calc_score($stud_id = null);
- $this->assertTrue(is_null($res));
-
- }
-
- public function testget_description() {
- $res = $this->exerciselink->get_description();
- $this->assertTrue(is_null($res));
-
- }
-
- public function testget_link() {
- $res = $this->exerciselink->get_link();
- $this->assertTrue(is_string($res));
-
- }
-
- public function testget_name() {
- $res = $this->exerciselink->get_name();
- $this->assertTrue(is_null($res));
-
- }
-
- public function testget_not_created_links() {
- $_SESSION['id_session'] = 1;
- $res = $this->exerciselink->get_not_created_links();
- $this->assertTrue(is_array($res));
- $_SESSION['id_session'] = null;
-
- }
- public function testget_type_name() {
- $res = $this->exerciselink->get_type_name();
- $this->assertTrue(is_string($res));
-
- }
-
- public function testhas_results() {
- $res = $this->exerciselink->has_results();
- $this->assertTrue(is_bool($res));
-
- }
- public function testis_allowed_to_change_name() {
- $res = $this->exerciselink->is_allowed_to_change_name();
- $this->assertTrue(is_bool($res));
-
- }
-
- public function testis_valid_link() {
- $res = $this->exerciselink->is_valid_link();
- $this->assertTrue(is_bool($res));
-
- }
- public function testneeds_max() {
- $res = $this->exerciselink->needs_max();
- $this->assertTrue(is_bool($res));
-
- }
- public function testneeds_name_and_description() {
- $res = $this->exerciselink->needs_name_and_description();
- $this->assertTrue(is_bool($res));
-
- }
- public function testneeds_results() {
- $res = $this->exerciselink->needs_results();
- $this->assertTrue(is_bool($res));
-
- }
- public function __destruct() {
-
- TestManager::delete_test_course('COURSEEXERCISELINK');
- }
- }
- ?>
|