17 $method = $class->getMethod(
$name);
18 $method->setAccessible(
true);
26 require_once
'./Modules/TestQuestionPool/classes/class.assLongMenu.php';
27 if (defined(
'ILIAS_PHPUNIT_CONTEXT')) {
28 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
29 ilUnitUtil::performInitialisation();
31 chdir(dirname(__FILE__));
34 require_once
'./Services/Utilities/classes/class.ilUtil.php';
40 $this->assertInstanceOf(
'assLongMenu', $instance);
46 $this->assertEquals(
'qpl_qst_lome', $instance->getAdditionalTableName());
52 $this->assertEquals(
'assLongMenu', $instance->getQuestionType());
58 $this->assertEquals(
'qpl_a_lome', $instance->getAnswerTableName());
63 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
65 $value = $method->invokeArgs($obj, array(array(array(5),1,1), array(1,2,3,4)));
66 $this->assertEquals(
true, $value);
71 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
73 $value = $method->invokeArgs($obj, array(array(array(1),1,1), array(1,2,3,4)));
74 $this->assertEquals(
false, $value);
80 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2', 2 =>
'1'),
81 1 => array( 0 => array(0 =>
'answer'),1 =>
'2', 2 =>
'1')));
82 $value = $obj->getMaximumPoints();
83 $this->assertEquals(4, $value);
89 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
90 1 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
91 $value = $obj->getMaximumPoints();
92 $this->assertEquals(4.5, $value);
98 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
99 1 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
100 $obj->setAnswers(array(array(1,2,3,4)));
101 $this->assertEquals($obj->isComplete(),
false);
107 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
108 1 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
109 $obj->setAnswers(array(array(1,2,3,4)));
110 $obj->setPoints(4.5);
111 $obj->setTitle(
'LongMenu Title');
112 $obj->setLongMenuTextValue(
'LongMenu Question');
113 $this->assertEquals($obj->isComplete(),
true);
119 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
125 $obj->setAnswers(array(array(1,2,3,4)));
126 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
132 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
133 1 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
134 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
139 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
140 1 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
141 $obj->setAnswers(array(array(
'answer')));
142 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
147 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
148 $obj->setAnswers(array(array(1)));
149 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
155 $obj->setCorrectAnswers(array( 0 => array( 0 => array(),1 =>
'2.25', 2 =>
'1')));
156 $obj->setAnswers(array(array(
'answer')));
157 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
163 $obj->setCorrectAnswers(array( 0 => array( 0 => array())));
164 $obj->setAnswers(array(array(
'answer')));
165 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
171 $obj->setCorrectAnswers(array( 0 => array( 0 => array(
'answer'),1 => 0, 2 =>
'1')));
172 $obj->setAnswers(array(array(
'answer')));
173 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
179 $obj->setCorrectAnswers(array( 0 => array( 0 => array(
'answer'),1 => 1, 2 =>
'1')));
180 $obj->setAnswers(array(array(
'answer')));
181 $this->assertEquals($obj->checkQuestionCustomPart(),
true);
187 $array = array( 0 =>
'squirrel', 1 =>
'icebear');
188 $_POST[
'answer'] = $array;
189 $this->assertEquals($obj->getSolutionSubmit(), $array);
195 $obj->setAnswerType(0);
196 $this->assertEquals(0, $obj->getAnswerType());
201 $this->assertEquals(
'', $obj->getLongMenuTextValue());
202 $obj->setLongMenuTextValue(
'dummy text');
203 $this->assertEquals(
'dummy text', $obj->getLongMenuTextValue());
209 $obj->setJsonStructure(json_encode(array(1 =>
'bla')));
210 $this->assertEquals(
'{"1":"bla"}', $obj->getJsonStructure());
216 $this->assertEquals(
false, $obj->isShuffleAnswersEnabled());
217 $this->assertNotEquals(
true, $obj->isShuffleAnswersEnabled());
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.