mirror of
https://github.com/moodle/moodle.git
synced 2025-03-10 10:58:38 +01:00
30 lines
885 B
PHP
30 lines
885 B
PHP
<?php
|
|
/**
|
|
* Unit tests for (some of) mod/quiz/locallib.php.
|
|
*
|
|
* @author T.J.Hunt@open.ac.uk
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
|
* @package quiz
|
|
*/
|
|
|
|
if (!defined('MOODLE_INTERNAL')) {
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page.
|
|
}
|
|
|
|
require_once($CFG->dirroot . '/mod/quiz/lib.php');
|
|
|
|
class quiz_lib_test extends UnitTestCase {
|
|
function test_quiz_has_grades() {
|
|
$quiz = new stdClass;
|
|
$quiz->grade = '100.0000';
|
|
$quiz->sumgrades = '100.0000';
|
|
$this->assertTrue(quiz_has_grades($quiz));
|
|
$quiz->sumgrades = '0.0000';
|
|
$this->assertFalse(quiz_has_grades($quiz));
|
|
$quiz->grade = '0.0000';
|
|
$this->assertFalse(quiz_has_grades($quiz));
|
|
$quiz->sumgrades = '100.0000';
|
|
$this->assertFalse(quiz_has_grades($quiz));
|
|
}
|
|
}
|
|
?>
|