3 declare(strict_types=1);
29 protected function setUp(): void
38 $this->assertInstanceOf(ilTestRandomQuestionSetQuestionCollection::class, $this->testObj);
48 $this->testObj->setQuestions($expected);
49 $this->assertEquals($expected, $this->testObj->getQuestions());
57 $this->assertCount(3, $this->testObj->getQuestions());
63 $ids = [125, 112, 10];
64 foreach ($ids as
$id) {
66 $question->setQuestionId($id);
67 $questions[] = $question;
70 $this->testObj->setQuestions($questions);
72 $this->assertEquals($questions[0], $this->testObj->current());
78 $ids = [125, 112, 10];
79 foreach ($ids as
$id) {
81 $question->setQuestionId($id);
82 $questions[] = $question;
85 $this->testObj->setQuestions($questions);
87 $this->assertEquals($questions[1], $this->testObj->next());
93 $ids = [125, 112, 10];
94 foreach ($ids as
$id) {
96 $question->setQuestionId($id);
97 $questions[] = $question;
100 $this->testObj->setQuestions($questions);
102 $this->assertEquals(0, $this->testObj->key());
104 $this->testObj->next();
105 $this->testObj->next();
106 $this->assertEquals(2, $this->testObj->key());
112 $ids = [125, 112, 10];
113 foreach ($ids as
$id) {
115 $question->setQuestionId($id);
116 $questions[] = $question;
119 $this->testObj->setQuestions($questions);
121 $this->assertTrue($this->testObj->valid());
123 $this->testObj->setQuestions([]);
124 $this->assertFalse($this->testObj->valid());
130 $ids = [125, 112, 10];
131 foreach ($ids as
$id) {
133 $question->setQuestionId($id);
134 $questions[] = $question;
137 $this->testObj->setQuestions($questions);
139 $this->assertEquals($questions[0], $this->testObj->current());
141 $this->testObj->next();
142 $this->testObj->next();
143 $this->assertEquals($questions[2], $this->testObj->current());
145 $this->testObj->rewind();
146 $this->assertEquals($questions[0], $this->testObj->current());
152 $ids = [125, 112, 10];
153 foreach ($ids as
$id) {
155 $question->setQuestionId($id);
156 $questions[] = $question;
159 $this->testObj->setQuestions($questions);
161 $this->assertTrue($this->testObj->isGreaterThan(2));
162 $this->assertTrue($this->testObj->isGreaterThan(1));
163 $this->assertFalse($this->testObj->isGreaterThan(6));
169 $ids = [125, 112, 10];
170 foreach ($ids as
$id) {
172 $question->setQuestionId($id);
173 $questions[] = $question;
176 $this->testObj->setQuestions($questions);
178 $this->assertFalse($this->testObj->isSmallerThan(3));
179 $this->assertFalse($this->testObj->isSmallerThan(1));
180 $this->assertTrue($this->testObj->isSmallerThan(6));
186 $ids = [125, 112, 10];
187 foreach ($ids as
$id) {
189 $question->setQuestionId($id);
190 $questions[] = $question;
193 $this->testObj->setQuestions($questions);
195 $this->assertEquals(0, $this->testObj->getMissingCount(3));
196 $this->assertEquals(0, $this->testObj->getMissingCount(1));
197 $this->assertEquals(3, $this->testObj->getMissingCount(6));
203 $ids = [125, 112, 10];
206 $question->setQuestionId(
$id);
207 $questions[
$index] = $question;
208 $this->testObj->addQuestion($question);
216 $question->setQuestionId(
$id);
217 $questions[
$index + 3] = $question;
218 $collection->addQuestion($question);
221 $this->testObj->mergeQuestionCollection($collection);
223 $this->assertEquals($questions, $this->testObj->getQuestions());
228 $ids = [125, 112, 10, 112];
229 foreach ($ids as
$id) {
231 $question->setQuestionId($id);
232 $this->testObj->addQuestion($question);
235 $this->assertCount(3, $this->testObj->getUniqueQuestionCollection()->getQuestions());
240 $ids = [125, 112, 10];
241 foreach ($ids as
$id) {
243 $question->setQuestionId($id);
244 $this->testObj->addQuestion($question);
247 $this->assertEquals(3, $this->testObj->getQuestionAmount());
252 $ids = [125, 112, 10];
253 foreach ($ids as
$id) {
255 $question->setQuestionId($id);
256 $this->testObj->addQuestion($question);
259 $this->assertEquals($ids, $this->testObj->getInvolvedQuestionIds());
testMergeQuestionCollection()
testGetInvolvedQuestionIds()
testGetUniqueQuestionCollection()
ilTestRandomQuestionSetQuestionCollection $testObj
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
test_instantiateObject_shouldReturnInstance()