15 $class =
new ReflectionClass(
'assLongMenu');
16 $method = $class->getMethod($name);
17 $method->setAccessible(
true);
25 require_once
'./Modules/TestQuestionPool/classes/class.assLongMenu.php';
26 if (
defined(
'ILIAS_PHPUNIT_CONTEXT'))
28 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
29 ilUnitUtil::performInitialisation();
33 chdir( dirname( __FILE__ ) );
36 require_once
'./Services/Utilities/classes/class.ilUtil.php';
42 $this->assertInstanceOf(
'assLongMenu', $instance);
48 $this->assertEquals(
'qpl_qst_lome', $instance->getAdditionalTableName());
54 $this->assertEquals(
'assLongMenu', $instance->getQuestionType());
60 $this->assertEquals(
'qpl_a_lome', $instance->getAnswerTableName());
65 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
68 $this->assertEquals(
true, $value);
73 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
76 $this->assertEquals(
false, $value);
82 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2', 2 =>
'1'),
83 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2', 2 =>
'1')));
84 $value = $obj->getMaximumPoints();
85 $this->assertEquals(4, $value);
91 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
92 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
93 $value = $obj->getMaximumPoints();
94 $this->assertEquals(4.5, $value);
100 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
101 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
103 $this->assertEquals($obj->isComplete(),
false);
109 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
110 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
112 $obj->setPoints(4.5);
113 $obj->setTitle(
'LongMenu Title');
114 $obj->setQuestion(
'LongMenu Question');
115 $this->assertEquals($obj->isComplete(),
true);
121 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
128 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
134 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
135 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
136 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
141 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
142 1 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
144 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
149 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
151 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
157 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (),1 =>
'2.25', 2 =>
'1')));
159 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
167 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
173 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (
'answer'),1 => 0, 2 =>
'1')));
175 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
181 $obj->setCorrectAnswers(
array ( 0 =>
array ( 0 =>
array (
'answer'),1 => 1, 2 =>
'1')));
183 $this->assertEquals($obj->checkQuestionCustomPart(),
true);
189 $array =
array( 0 =>
'squirrel', 1 =>
'icebear');
190 $_POST[
'answer'] = $array;
191 $this->assertEquals($obj->getSolutionSubmit(), $array);
197 $obj->setAnswerType(0);
198 $this->assertEquals(0, $obj->getAnswerType());
203 $this->assertEquals(
'', $obj->getLongMenuTextValue());
204 $obj->setLongMenuTextValue(
'dummy text');
205 $this->assertEquals(
'dummy text', $obj->getLongMenuTextValue());
211 $obj->setJsonStructure(json_encode(
array(1 =>
'bla')));
212 $this->assertEquals(
'{"1":"bla"}', $obj->getJsonStructure());
218 $this->assertEquals(
false, $obj->isShuffleAnswersEnabled());
219 $this->assertNotEquals(
true, $obj->isShuffleAnswersEnabled());
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'