ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestRandomQuestionSetConfigTest.php
Go to the documentation of this file.
1 <?php
2 
24 {
26 
27  protected function setUp(): void
28  {
29  parent::setUp();
30 
31  $this->testObj = new ilTestRandomQuestionSetConfig(
32  $this->getMockBuilder(ilTree::class)->disableOriginalConstructor()->getMock(),
33  $this->createMock(ilDBInterface::class),
34  $this->createMock(ilLanguage::class),
35  $this->createMock(ILIAS\Test\Logging\TestLogger::class),
36  $this->createMock(ilComponentRepository::class),
37  $this->getMockBuilder(ilObjTest::class)->disableOriginalConstructor()->getMock(),
38  $this->getMockBuilder(\ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository::class)->disableOriginalConstructor()->getMock()
39  );
40  }
41 
43  {
44  $this->assertInstanceOf(ilTestRandomQuestionSetConfig::class, $this->testObj);
45  }
46 
48  {
49  $this->testObj->setPoolsWithHomogeneousScoredQuestionsRequired(false);
50  $this->assertFalse($this->testObj->arePoolsWithHomogeneousScoredQuestionsRequired());
51 
52  $this->testObj->setPoolsWithHomogeneousScoredQuestionsRequired(true);
53  $this->assertTrue($this->testObj->arePoolsWithHomogeneousScoredQuestionsRequired());
54  }
55 
56  public function testQuestionAmountConfigurationMode(): void
57  {
58  $questionAmountConfigurationMode = 'test';
59  $this->testObj->setQuestionAmountConfigurationMode($questionAmountConfigurationMode);
60  $this->assertEquals($questionAmountConfigurationMode, $this->testObj->getQuestionAmountConfigurationMode());
61  }
62 
64  {
65  $this->testObj->setQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST);
66  $this->assertFalse($this->testObj->isQuestionAmountConfigurationModePerPool());
67 
68  $this->testObj->setQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL);
69  $this->assertTrue($this->testObj->isQuestionAmountConfigurationModePerPool());
70  }
71 
73  {
74  $this->testObj->setQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL);
75  $this->assertFalse($this->testObj->isQuestionAmountConfigurationModePerTest());
76 
77  $this->testObj->setQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST);
78  $this->assertTrue($this->testObj->isQuestionAmountConfigurationModePerTest());
79  }
80 
82  {
83  $this->assertFalse($this->testObj->isValidQuestionAmountConfigurationMode(200));
84  $this->assertTrue($this->testObj->isValidQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL));
85  $this->assertTrue($this->testObj->isValidQuestionAmountConfigurationMode(ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST));
86  }
87 
88  public function testQuestionAmountPerTest(): void
89  {
90  $questionAmountPerTest = 222;
91  $this->testObj->setQuestionAmountPerTest($questionAmountPerTest);
92  $this->assertEquals($questionAmountPerTest, $this->testObj->getQuestionAmountPerTest());
93  }
94 
95  public function testLastQuestionSyncTimestamp(): void
96  {
97  $lastQuestionSyncTimestamp = 222;
98  $this->testObj->setLastQuestionSyncTimestamp($lastQuestionSyncTimestamp);
99  $this->assertEquals($lastQuestionSyncTimestamp, $this->testObj->getLastQuestionSyncTimestamp());
100  }
101 }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...