MDL-29794 Initial support for re-using a shared grading form
[moodle.git] / grade / simpletest / testedittree.php
CommitLineData
73185e82
AD
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * Unit tests for grade/edit/tree/lib.php.
20 *
21 * @author Andrew Davis
22 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
23 * @package moodlecore
24 */
25
26
27if (!defined('MOODLE_INTERNAL')) {
28 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
29}
30
31require_once($CFG->dirroot.'/grade/edit/tree/lib.php');
32
33/**
34 * Tests grade_edit_tree (deals with the data on the categories and items page in the gradebook)
35 */
36class gradeedittreelib_test extends UnitTestCase {
37 var $courseid = 1;
38 var $context = null;
39 var $grade_edit_tree = null;
40 public static $includecoverage = array('grade/edit/tree/lib.php');
41
42 function setUp() {
43 }
44
45 public function test_format_number() {
46 $numinput = array( 0, 1, 1.01, '1.010', 1.2345);
47 $numoutput = array(0.0, 1.0, 1.01, 1.01, 1.2345);
48
49 for ($i=0; $i<sizeof($numinput); $i++) {
50 $msg = 'format_number() testing '.$numinput[$i].' %s';
51 $this->assertEqual(grade_edit_tree::format_number($numinput[$i]),$numoutput[$i],$msg);
52 }
53 }
54
55}
56
57