From a8caf69d3abaa0a136eeec8465d0161d9b5cb7cd Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 31 Oct 2007 14:55:23 +0000 Subject: [PATCH] Minor changes in unit tests --- lib/grade/grade_outcome.php | 2 +- lib/grade/simpletest/testgradeitem.php | 4 ++-- lib/grade/simpletest/testgradeoutcome.php | 4 ++-- lib/simpletest/fixtures/gradetest.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/grade/grade_outcome.php b/lib/grade/grade_outcome.php index 1eb2422d82..3de0d1305b 100644 --- a/lib/grade/grade_outcome.php +++ b/lib/grade/grade_outcome.php @@ -7,7 +7,7 @@ // Moodle - Modular Object-Oriented Dynamic Learning Environment // // http://moodle.com // // // -// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // +// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/lib/grade/simpletest/testgradeitem.php b/lib/grade/simpletest/testgradeitem.php index 520417888f..20da15ab4a 100755 --- a/lib/grade/simpletest/testgradeitem.php +++ b/lib/grade/simpletest/testgradeitem.php @@ -361,7 +361,7 @@ class grade_item_test extends grade_test { $this->assertFalse(empty($grade_item->locked)); $this->assertFalse(empty($grade->locked)); // individual grades should be locked too - $this->assertTrue($grade_item->set_locked(false)); + $this->assertTrue($grade_item->set_locked(false, true)); $grade = new grade_grade($grade_item->get_final(1)); $this->assertTrue(empty($grade_item->locked)); @@ -390,7 +390,7 @@ class grade_item_test extends grade_test { $this->assertEqual(0, $grade_item->hidden); $this->assertEqual(0, $grade->hidden); - $grade_item->set_hidden(666); + $grade_item->set_hidden(666, true); $grade = new grade_grade($grade_item->get_final(1)); $this->assertEqual(666, $grade_item->hidden); diff --git a/lib/grade/simpletest/testgradeoutcome.php b/lib/grade/simpletest/testgradeoutcome.php index d21369f42b..a8724503b5 100644 --- a/lib/grade/simpletest/testgradeoutcome.php +++ b/lib/grade/simpletest/testgradeoutcome.php @@ -7,7 +7,7 @@ // Moodle - Modular Object-Oriented Dynamic Learning Environment // // http://moodle.org // // // -// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // +// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -91,7 +91,7 @@ class grade_outcome_test extends grade_test { $grade_outcome = grade_outcome::fetch(array('id'=>$this->grade_outcomes[0]->id)); $this->assertEqual($this->grade_outcomes[0]->id, $grade_outcome->id); $this->assertEqual($this->grade_outcomes[0]->shortname, $grade_outcome->shortname); - + $grade_outcome->load_scale(); $this->assertEqual($this->scale[2]->id, $grade_outcome->scale->id); } diff --git a/lib/simpletest/fixtures/gradetest.php b/lib/simpletest/fixtures/gradetest.php index 63b8d683bb..ee2de17035 100644 --- a/lib/simpletest/fixtures/gradetest.php +++ b/lib/simpletest/fixtures/gradetest.php @@ -114,7 +114,7 @@ class grade_test extends UnitTestCase { /// Define table course_modules to be created $table = new XMLDBTable('course_modules'); - if (!table_exists($table)) { + if ($result && !table_exists($table)) { /// Adding fields to table course_modules $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); $table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); @@ -151,7 +151,7 @@ class grade_test extends UnitTestCase { /// Define table modules to be created $table = new XMLDBTable('modules'); - if (!table_exists($table)) { + if ($result && !table_exists($table)) { /// Adding fields to table modules $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); @@ -177,7 +177,7 @@ class grade_test extends UnitTestCase { /// Define table grade_items to be created $table = new XMLDBTable('grade_items'); - if (!table_exists($table)) { + if ($result && !table_exists($table)) { $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null); $table->addFieldInfo('categoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null); -- 2.39.5