. /** * Unit tests for (some of) ../questionlib.php. * * @package moodlecore * @subpackage questionbank * @copyright 2006 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/questionlib.php'); /** * Unit tests for (some of) ../questionlib.php. * * @copyright 2006 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class questionlib_test extends UnitTestCase { public static $includecoverage = array('lib/questionlib.php'); public function test_question_reorder_qtypes() { $this->assertEqual(question_reorder_qtypes( array('t1' => '', 't2' => '', 't3' => ''), 't1', +1), array(0 => 't2', 1 => 't1', 2 => 't3')); $this->assertEqual(question_reorder_qtypes( array('t1' => '', 't2' => '', 't3' => ''), 't1', -1), array(0 => 't1', 1 => 't2', 2 => 't3')); $this->assertEqual(question_reorder_qtypes( array('t1' => '', 't2' => '', 't3' => ''), 't2', -1), array(0 => 't2', 1 => 't1', 2 => 't3')); $this->assertEqual(question_reorder_qtypes( array('t1' => '', 't2' => '', 't3' => ''), 't3', +1), array(0 => 't1', 1 => 't2', 2 => 't3')); $this->assertEqual(question_reorder_qtypes( array('t1' => '', 't2' => '', 't3' => ''), 'missing', +1), array(0 => 't1', 1 => 't2', 2 => 't3')); } }