MDL-31873 added mod_assign_get_grades web service function
[moodle.git] / grade / tests / edittree_test.php
CommitLineData
50738805
PS
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * Unit tests for grade/edit/tree/lib.php.
19 *
20 * @pacakge core_grade
21 * @category phpunit
22 * @author Andrew Davis
23 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
24 */
25
26defined('MOODLE_INTERNAL') || die();
27
28global $CFG;
29require_once($CFG->dirroot.'/grade/edit/tree/lib.php');
30
31
32/**
33 * Tests grade_edit_tree (deals with the data on the categories and items page in the gradebook)
34 */
35class gradeedittreelib_testcase extends basic_testcase {
36 var $courseid = 1;
37 var $context = null;
38 var $grade_edit_tree = null;
39
40 public function test_format_number() {
41 $numinput = array( 0, 1, 1.01, '1.010', 1.2345);
42 $numoutput = array(0.0, 1.0, 1.01, 1.01, 1.2345);
43
44 for ($i=0; $i<sizeof($numinput); $i++) {
45 $msg = 'format_number() testing '.$numinput[$i].' %s';
46 $this->assertEquals(grade_edit_tree::format_number($numinput[$i]),$numoutput[$i],$msg);
47 }
48 }
49
50}
51
52