ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SettingsGamificationTest.php
Go to the documentation of this file.
1<?php
2
19namespace ScoreReporting;
20
23
25{
26 public function testConstruct(): void
27 {
28 $gamificationTest = new SettingsGamification(0);
29 $this->assertInstanceOf(SettingsGamification::class, $gamificationTest);
30 }
31
32 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreEnabledDataProvider')]
33 public function testGetAndWithHighscoreEnabled(bool $IO): void
34 {
35 $gamificationTest = new SettingsGamification(0);
36 $gamificationTest = $gamificationTest->withHighscoreEnabled($IO);
37 $this->assertEquals($IO, $gamificationTest->getHighscoreEnabled());
38 }
39
40 public static function getAndWithHighscoreEnabledDataProvider(): array
41 {
42 return [
43 [true],
44 [false]
45 ];
46 }
47
48 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreOwnTableDataProvider')]
49 public function testGetAndWithHighscoreOwnTable(bool $IO): void
50 {
51 $gamificationTest = new SettingsGamification(0);
52 $gamificationTest = $gamificationTest->withHighscoreOwnTable($IO);
53 $this->assertEquals($IO, $gamificationTest->getHighscoreOwnTable());
54 }
55
56 public static function getAndWithHighscoreOwnTableDataProvider(): array
57 {
58 return [
59 [true],
60 [false]
61 ];
62 }
63
64 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreTopTableDataProvider')]
65 public function testGetAndWithHighscoreTopTable(bool $IO): void
66 {
67 $gamificationTest = new SettingsGamification(0);
68 $gamificationTest = $gamificationTest->withHighscoreTopTable($IO);
69 $this->assertEquals($IO, $gamificationTest->getHighscoreTopTable());
70 }
71
72 public static function getAndWithHighscoreTopTableDataProvider(): array
73 {
74 return [
75 [true],
76 [false]
77 ];
78 }
79
80 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreTopNumDataProvider')]
81 public function testGetAndWithHighscoreTopNum(int $IO): void
82 {
83 $gamificationTest = new SettingsGamification(0);
84 $gamificationTest = $gamificationTest->withHighscoreTopNum($IO);
85 $this->assertEquals($IO, $gamificationTest->getHighscoreTopNum());
86 }
87
88 public static function getAndWithHighscoreTopNumDataProvider(): array
89 {
90 return [
91 [-1],
92 [0],
93 [1]
94 ];
95 }
96
97 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreAnonDataProvider')]
98 public function testGetAndWithHighscoreAnon(bool $IO): void
99 {
100 $gamificationTest = new SettingsGamification(0);
101 $gamificationTest = $gamificationTest->withHighscoreAnon($IO);
102 $this->assertEquals($IO, $gamificationTest->getHighscoreAnon());
103 }
104
105 public static function getAndWithHighscoreAnonDataProvider(): array
106 {
107 return [
108 [true],
109 [false],
110 ];
111 }
112
113 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreAchievedTSDataProvider')]
114 public function testGetAndWithHighscoreAchievedTS(bool $IO): void
115 {
116 $gamificationTest = new SettingsGamification(0);
117 $gamificationTest = $gamificationTest->withHighscoreAchievedTS($IO);
118 $this->assertEquals($IO, $gamificationTest->getHighscoreAchievedTS());
119 }
120
121 public static function getAndWithHighscoreAchievedTSDataProvider(): array
122 {
123 return [
124 [true],
125 [false]
126 ];
127 }
128
129 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreScoreDataProvider')]
130 public function testGetAndWithHighscoreScore(bool $IO): void
131 {
132 $gamificationTest = new SettingsGamification(0);
133 $gamificationTest = $gamificationTest->withHighscoreScore($IO);
134 $this->assertEquals($IO, $gamificationTest->getHighscoreScore());
135 }
136
137 public static function getAndWithHighscoreScoreDataProvider(): array
138 {
139 return [
140 [true],
141 [false]
142 ];
143 }
144
145 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscorePercentageDataProvider')]
146 public function testGetAndWithHighscorePercentage(bool $IO): void
147 {
148 $gamificationTest = new SettingsGamification(0);
149 $gamificationTest = $gamificationTest->withHighscorePercentage($IO);
150 $this->assertEquals($IO, $gamificationTest->getHighscorePercentage());
151 }
152
153 public static function getAndWithHighscorePercentageDataProvider(): array
154 {
155 return [
156 [true],
157 [false]
158 ];
159 }
160
161 #[\PHPUnit\Framework\Attributes\DataProvider('getAndWithHighscoreWTimeDataProvider')]
162 public function testGetAndWithHighscoreWTime(bool $IO): void
163 {
164 $gamificationTest = new SettingsGamification(0);
165 $gamificationTest = $gamificationTest->withHighscoreWTime($IO);
166 $this->assertEquals($IO, $gamificationTest->getHighscoreWTime());
167 }
168
169 public static function getAndWithHighscoreWTimeDataProvider(): array
170 {
171 return [
172 [true],
173 [false]
174 ];
175 }
176}
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...