ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestSkillPointAccountTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
33  $this->testObj = new ilTestSkillPointAccount();
34  }
35 
37  {
38  $this->assertInstanceOf(ilTestSkillPointAccount::class, $this->testObj);
39  }
40 
41  public function testAddBooking(): void
42  {
43  $maxSkillPoints1 = 80;
44  $reachedSkillPoints1 = 20;
45  $this->testObj->addBooking($maxSkillPoints1, $reachedSkillPoints1);
46  $this->assertEquals($maxSkillPoints1, $this->testObj->getTotalMaxSkillPoints());
47  $this->assertEquals($reachedSkillPoints1, $this->testObj->getTotalReachedSkillPoints());
48 
49  $maxSkillPoints2 = 50;
50  $reachedSkillPoints2 = 10;
51  $this->testObj->addBooking($maxSkillPoints2, $reachedSkillPoints2);
52  $this->assertEquals($maxSkillPoints1 + $maxSkillPoints2, $this->testObj->getTotalMaxSkillPoints());
53  $this->assertEquals($reachedSkillPoints1 + $reachedSkillPoints2, $this->testObj->getTotalReachedSkillPoints());
54  }
55 
56  public function testGetTotalReachedSkillPercent(): void
57  {
58  $maxSkillPoints1 = 80;
59  $reachedSkillPoints1 = 20;
60  $maxSkillPoints2 = 20;
61  $reachedSkillPoints2 = 30;
62 
63  $this->testObj->addBooking($maxSkillPoints1, $reachedSkillPoints1);
64  $this->testObj->addBooking($maxSkillPoints2, $reachedSkillPoints2);
65  $this->assertEquals(($reachedSkillPoints1 + $reachedSkillPoints2) / ($maxSkillPoints1 + $maxSkillPoints2) * 100, $this->testObj->getTotalReachedSkillPercent());
66  }
67 }
Class ilTestSkillPointAccountTest.