Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 27... Línea 27...
27
 * @category   test
27
 * @category   test
28
 * @copyright  nicolas@moodle.com
28
 * @copyright  nicolas@moodle.com
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
30
 */
31
class grade_item_test extends \grade_base_testcase {
31
class grade_item_test extends \grade_base_testcase {
32
    public function test_grade_item() {
32
    public function test_grade_item(): void {
33
        $this->sub_test_grade_item_construct();
33
        $this->sub_test_grade_item_construct();
34
        $this->sub_test_grade_item_insert();
34
        $this->sub_test_grade_item_insert();
35
        $this->sub_test_grade_item_delete();
35
        $this->sub_test_grade_item_delete();
36
        $this->sub_test_grade_item_update();
36
        $this->sub_test_grade_item_update();
37
        $this->sub_test_grade_item_load_scale();
37
        $this->sub_test_grade_item_load_scale();
Línea 816... Línea 816...
816
        $item->id = $DB->insert_record('grade_items', $item);
816
        $item->id = $DB->insert_record('grade_items', $item);
Línea 817... Línea 817...
817
 
817
 
818
        return $DB->get_record('grade_items', array('id' => $item->id));
818
        return $DB->get_record('grade_items', array('id' => $item->id));
Línea 819... Línea 819...
819
    }
819
    }
820
 
820
 
821
    public function test_set_aggregation_fields_for_aggregation() {
821
    public function test_set_aggregation_fields_for_aggregation(): void {
Línea 822... Línea 822...
822
        $course = $this->getDataGenerator()->create_course();
822
        $course = $this->getDataGenerator()->create_course();
823
        $gi = new \grade_item(array('courseid' => $course->id, 'itemtype' => 'manual'), false);
823
        $gi = new \grade_item(array('courseid' => $course->id, 'itemtype' => 'manual'), false);
Línea 1069... Línea 1069...
1069
 
1069
 
1070
 
1070
 
1071
    /**
1071
    /**
1072
     * Test grade item duplication expecting success.
1072
     * Test grade item duplication expecting success.
1073
     */
1073
     */
1074
    public function test_grade_duplicate_grade_item_success() {
1074
    public function test_grade_duplicate_grade_item_success(): void {
1075
        $cat = new \grade_category();
1075
        $cat = new \grade_category();
1076
        $cat->courseid = $this->courseid;
1076
        $cat->courseid = $this->courseid;
Línea 1109... Línea 1109...
1109
    }
1109
    }
Línea 1110... Línea 1110...
1110
 
1110
 
1111
    /**
1111
    /**
1112
     * Test grade item duplication exception expected with incomplete grade item.
1112
     * Test grade item duplication exception expected with incomplete grade item.
1113
     */
1113
     */
1114
    public function test_grade_duplicate_grade_item_incomplete() {
1114
    public function test_grade_duplicate_grade_item_incomplete(): void {
1115
        // Grade item is not valid because it is empty.
1115
        // Grade item is not valid because it is empty.
1116
        $gi = new \grade_item();
1116
        $gi = new \grade_item();
1117
        $gi->courseid = $this->courseid;
1117
        $gi->courseid = $this->courseid;
1118
        $this->expectException("moodle_exception");
1118
        $this->expectException("moodle_exception");
1119
        $gi2 = $gi->duplicate();
1119
        $gi2 = $gi->duplicate();
Línea 1120... Línea 1120...
1120
    }
1120
    }
1121
 
1121
 
1122
    /**
1122
    /**
1123
     * Test grade item duplication exception expected because item must be in db.
1123
     * Test grade item duplication exception expected because item must be in db.
1124
     */
1124
     */
1125
    public function test_grade_duplicate_grade_item_not_in_db() {
1125
    public function test_grade_duplicate_grade_item_not_in_db(): void {
1126
        $cat = new \grade_category();
1126
        $cat = new \grade_category();
1127
        $cat->courseid = $this->courseid;
1127
        $cat->courseid = $this->courseid;