ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 
58  /* Removed by @kergomard 17 NOV 2022, we should introduce this again
59  public function test_getAnswerCount_shouldReturnCount(): void
60  {
61  $obj = new assMultipleChoice();
62  $this->assertEquals(0, $obj->getAnswerCount());
63  $obj->addAnswer('Points for checked', 1, 0, 0);
64  $obj->addAnswer('Points for unchecked', 0, 1, 1);
65  $this->assertEquals(2, $obj->getAnswerCount());
66  $obj->deleteAnswer(0);
67  $this->assertEquals(1, $obj->getAnswerCount());
68  }
69 
70  public function test_flushAnswers_shouldClearAnswers(): void
71  {
72  $obj = new assMultipleChoice();
73  $obj->addAnswer('1', 1, 0, 0);
74  $obj->addAnswer('1', 1, 0, 1);
75  $this->assertEquals(2, $obj->getAnswerCount());
76  $obj->flushAnswers();
77  $this->assertEquals(0, $obj->getAnswerCount());
78  } */
79 
81  {
82  $obj = new assMultipleChoice();
83  $this->assertEquals('assMultipleChoice', $obj->getQuestionType());
84  }
85 
87  {
88  $obj = new assMultipleChoice();
89  $this->assertEquals('qpl_qst_mc', $obj->getAdditionalTableName());
90  }
91 
93  {
94  $obj = new assMultipleChoice();
95  $this->assertEquals('qpl_a_mc', $obj->getAnswerTableName());
96  }
97 
98  /* Removed by @kergomard 17 NOV 2022, we should introduce this again
99  public function test_getMaximumPoints_shouldReturnAnswerTableName(): void
100  {
101  $obj = new assMultipleChoice();
102  $obj->addAnswer('Points for checked', 1, 0, 0);
103  $obj->addAnswer('Points for checked', 1, 0, 1);
104  $this->assertEquals(2, $obj->getMaximumPoints());
105  }
106  public function test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName(): void
107  {
108  $obj = new assMultipleChoice();
109  $obj->addAnswer('Points for unchecked', 0, 1, 0);
110  $obj->addAnswer('Points for unchecked', 0, 1, 1);
111  $this->assertEquals(2, $obj->getMaximumPoints());
112  }
113  public function test_getMaximumPointsMixed_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  $obj->addAnswer('Points for checked', 1, 0, 2);
120  $obj->addAnswer('Points for checked', 1, 0, 3);
121  $this->assertEquals(4, $obj->getMaximumPoints());
122  $obj->addAnswer('Points for checked', 1, 1, 4);
123  $obj->addAnswer('Points for checked', 1, 1, 5);
124  $this->assertEquals(6, $obj->getMaximumPoints());
125  } */
126 }
test_getAdditionalTableName_shouldReturnAdditionalTableName()
Class assBaseTestCase.
Class for multiple choice tests.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setGlobalVariable(string $name, $value)