ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestRandomQuestionCollectionSubsetApplicationTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
34  }
35 
37  {
38  $this->assertInstanceOf(ilTestRandomQuestionCollectionSubsetApplication::class, $this->testObj);
39  }
40 
41  public function testApplicantId(): void
42  {
43  $this->testObj->setApplicantId(12);
44  $this->assertEquals(12, $this->testObj->getApplicantId());
45  }
46 
47  public function testRequiredAmount(): void
48  {
49  $this->testObj->setRequiredAmount(12);
50  $this->assertEquals(12, $this->testObj->getRequiredAmount());
51  }
52 
53  public function testHasRequiredAmountLeft(): void
54  {
55  $this->testObj->setRequiredAmount(5);
56  $this->assertTrue($this->testObj->hasRequiredAmountLeft());
57 
58  $this->testObj->setRequiredAmount(-200);
59  $this->assertFalse($this->testObj->hasRequiredAmountLeft());
60 
61  $this->testObj->setRequiredAmount(0);
62  $this->assertFalse($this->testObj->hasRequiredAmountLeft());
63  }
64 
65  public function testDecrementRequiredAmount(): void
66  {
67  $this->testObj->setRequiredAmount(5);
68  $this->testObj->decrementRequiredAmount();
69  $this->assertEquals(4, $this->testObj->getRequiredAmount());
70  }
71 
72  public function testHasQuestion(): void
73  {
74  $this->assertFalse($this->testObj->hasQuestion(2));
75 
76  $question = new ilTestRandomQuestionSetQuestion();
77  $question->setQuestionId(2);
78 
79  $this->testObj->addQuestion($question);
80  $this->assertTrue($this->testObj->hasQuestion(2));
81  }
82 
83  public function testGetQuestion(): void
84  {
85  $question = new ilTestRandomQuestionSetQuestion();
86  $question->setQuestionId(2);
87  $this->testObj->addQuestion($question);
88 
89  $this->assertEquals($question, $this->testObj->getQuestion(2));
90  }
91 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestBaseClass.