ILIAS  release_8 Revision v8.24
assMultipleChoiceTest.php
Go to the documentation of this file.
1<?php
2
29{
30 protected $backupGlobals = false;
31
32 protected function setUp(): void
33 {
34 parent::setUp();
35 $this->setGlobalVariable('ilias', $this->getIliasMock());
36 $this->setGlobalVariable('tpl', $this->getGlobalTemplateMock());
37 }
38
39 /* Removed by @kergomard 17 NOV 2022, we should introduce this again
40 public function test_isComplete_shouldReturnTrue(): void
41 {
42 $obj = new assMultipleChoice();
43 $this->assertEquals(false, $obj->isComplete());
44 $obj->setTitle('Tilte');
45 $obj->setAuthor('Me or another');
46 $obj->setQuestion('My great Question.');
47 $obj->addAnswer('Super simple single Choice', 1);
48
49 $this->assertEquals(true, $obj->isComplete());
50 } */
51
53 {
54 $obj = new assMultipleChoice();
55 $this->assertEquals('thumb.', $obj->getThumbPrefix());
56 }
57
59 {
60 $obj = new assMultipleChoice();
61 $obj->setOutputType(0);
62 $this->assertEquals(0, $obj->getOutputType());
63 }
64
65 /* Removed by @kergomard 17 NOV 2022, we should introduce this again
66 public function test_getAnswerCount_shouldReturnCount(): void
67 {
68 $obj = new assMultipleChoice();
69 $this->assertEquals(0, $obj->getAnswerCount());
70 $obj->addAnswer('Points for checked', 1, 0, 0);
71 $obj->addAnswer('Points for unchecked', 0, 1, 1);
72 $this->assertEquals(2, $obj->getAnswerCount());
73 $obj->deleteAnswer(0);
74 $this->assertEquals(1, $obj->getAnswerCount());
75 }
76
77 public function test_flushAnswers_shouldClearAnswers(): void
78 {
79 $obj = new assMultipleChoice();
80 $obj->addAnswer('1', 1, 0, 0);
81 $obj->addAnswer('1', 1, 0, 1);
82 $this->assertEquals(2, $obj->getAnswerCount());
83 $obj->flushAnswers();
84 $this->assertEquals(0, $obj->getAnswerCount());
85 } */
86
88 {
89 $obj = new assMultipleChoice();
90 $this->assertEquals('assMultipleChoice', $obj->getQuestionType());
91 }
92
94 {
95 $obj = new assMultipleChoice();
96 $this->assertEquals('qpl_qst_mc', $obj->getAdditionalTableName());
97 }
98
100 {
101 $obj = new assMultipleChoice();
102 $this->assertEquals('qpl_a_mc', $obj->getAnswerTableName());
103 }
104
105 /* Removed by @kergomard 17 NOV 2022, we should introduce this again
106 public function test_getMaximumPoints_shouldReturnAnswerTableName(): void
107 {
108 $obj = new assMultipleChoice();
109 $obj->addAnswer('Points for checked', 1, 0, 0);
110 $obj->addAnswer('Points for checked', 1, 0, 1);
111 $this->assertEquals(2, $obj->getMaximumPoints());
112 }
113 public function test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName(): void
114 {
115 $obj = new assMultipleChoice();
116 $obj->addAnswer('Points for unchecked', 0, 1, 0);
117 $obj->addAnswer('Points for unchecked', 0, 1, 1);
118 $this->assertEquals(2, $obj->getMaximumPoints());
119 }
120 public function test_getMaximumPointsMixed_shouldReturnAnswerTableName(): void
121 {
122 $obj = new assMultipleChoice();
123 $obj->addAnswer('Points for unchecked', 0, 1, 0);
124 $obj->addAnswer('Points for unchecked', 0, 1, 1);
125 $this->assertEquals(2, $obj->getMaximumPoints());
126 $obj->addAnswer('Points for checked', 1, 0, 2);
127 $obj->addAnswer('Points for checked', 1, 0, 3);
128 $this->assertEquals(4, $obj->getMaximumPoints());
129 $obj->addAnswer('Points for checked', 1, 1, 4);
130 $obj->addAnswer('Points for checked', 1, 1, 5);
131 $this->assertEquals(6, $obj->getMaximumPoints());
132 } */
133}
Class assBaseTestCase.
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_getAdditionalTableName_shouldReturnAdditionalTableName()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...