testquestiontype.php
来自「很棒的在线教学系统」· PHP 代码 · 共 74 行
PHP
74 行
<?php // $Id: testquestiontype.php,v 1.1.2.1 2009/03/26 08:42:18 tjhunt Exp $///////////////////////////////////////////////////////////////////////////// //// NOTICE OF COPYRIGHT //// //// Moodle - Modular Object-Oriented Dynamic Learning Environment //// http://moodle.org //// //// 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 //// the Free Software Foundation; either version 2 of the License, or //// (at your option) any later version. //// //// This program is distributed in the hope that it will be useful, //// but WITHOUT ANY WARRANTY; without even the implied warranty of //// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //// GNU General Public License for more details: //// //// http://www.gnu.org/copyleft/gpl.html //// //////////////////////////////////////////////////////////////////////////////** * Tests for some of ../questiontype.php * * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package moodlecore */if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page}require_once($CFG->dirroot . '/question/type/questiontype.php');class default_questiontype_test extends UnitTestCase { protected $qtype; public function setUp() { $this->qtype = new default_questiontype(); } public function tearDown() { $this->qtype = null; } function test_compare_responses() { $question = new stdClass; $state = new stdClass; $teststate = new stdClass; $state->responses = array(); $teststate->responses = array(); $this->assertTrue($this->qtype->compare_responses($question, $state, $teststate)); $state->responses = array('' => 'frog'); $teststate->responses = array('' => 'toad'); $this->assertFalse($this->qtype->compare_responses($question, $state, $teststate)); $state->responses = array('x' => 'frog'); $teststate->responses = array('y' => 'frog'); $this->assertFalse($this->qtype->compare_responses($question, $state, $teststate)); $state->responses = array(1 => 1, 2 => 2); $teststate->responses = array(2 => 2, 1 => 1); $this->assertTrue($this->qtype->compare_responses($question, $state, $teststate)); }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?