ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
MarkTest Class Reference

Unit tests for Mark. More...

+ Inheritance diagram for MarkTest:
+ Collaboration diagram for MarkTest:

Public Member Functions

 testGetWithShortName ()
 Basic Get/Set test on member short name using accessor methods. More...
 
 testGetWithPassed ()
 Basic Get/Set test on member passed using accessor methods. More...
 
 testGetWithOfficialName ()
 Basic Get/Set test on member officialName using accessor methods. More...
 
 testGetWithMinimumLevel ()
 Basic Get/Set test on member minimumLevel using accessor methods. More...
 
 testWithMinimumLevel_High ()
 Set test on member minimumLevel using accessor method with a high level. More...
 
 testWithMinimumLevel_Low ()
 Set test on member minimumLevel using accessor methods with a very low level. More...
 
 testWithMinimumLevel_TooLow ()
 Set test on member minimumLevel using accessor methods with a too low level. More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 
Mark $ass_mark
 

Detailed Description

Unit tests for Mark.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$ \

Definition at line 30 of file MarkTest.php.

Member Function Documentation

◆ setUp()

MarkTest::setUp ( )
protected

Definition at line 36 of file MarkTest.php.

36  : void
37  {
38  chdir(dirname(__FILE__));
39  chdir('../../../../');
40 
41  $this->ass_mark = new Mark();
42  }
A class defining marks for assessment test objects.
Definition: Mark.php:35

◆ testGetWithMinimumLevel()

MarkTest::testGetWithMinimumLevel ( )

Basic Get/Set test on member minimumLevel using accessor methods.

Definition at line 107 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getMinimumLevel(), and ILIAS\Test\Scoring\Marks\Mark\withMinimumLevel().

108  {
109  // Arrange
110  $expected = 50;
111  $ass_mark = $this->ass_mark->withMinimumLevel($expected);
112 
113  // Act
114  $actual = $ass_mark->getMinimumLevel();
115 
116  // Assert
117  $this->assertEquals(
118  $actual,
119  $expected,
120  "Get/Set on minimumLevel failed, in/out not matching."
121  );
122  }
withMinimumLevel(float $minimum_level)
Definition: Mark.php:74
Mark $ass_mark
Definition: MarkTest.php:34
+ Here is the call graph for this function:

◆ testGetWithOfficialName()

MarkTest::testGetWithOfficialName ( )

Basic Get/Set test on member officialName using accessor methods.

Definition at line 87 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getOfficialName(), and ILIAS\Test\Scoring\Marks\Mark\withOfficialName().

88  {
89  // Arrange
90  $expected = "Esther The Tester";
91  $ass_mark = $this->ass_mark->withOfficialName($expected);
92 
93  // Act
94  $actual = $ass_mark->getOfficialName();
95 
96  // Assert
97  $this->assertEquals(
98  $actual,
99  $expected,
100  "Get/Set on officialName failed, in/out not matching."
101  );
102  }
Mark $ass_mark
Definition: MarkTest.php:34
withOfficialName(string $official_name)
Definition: Mark.php:62
+ Here is the call graph for this function:

◆ testGetWithPassed()

MarkTest::testGetWithPassed ( )

Basic Get/Set test on member passed using accessor methods.

Definition at line 67 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getPassed(), and ILIAS\Test\Scoring\Marks\Mark\withPassed().

68  {
69  // Arrange
70  $expected = true;
71  $ass_mark = $this->ass_mark->withPassed($expected);
72 
73  // Act
74  $actual = $ass_mark->getPassed();
75 
76  // Assert
77  $this->assertEquals(
78  $actual,
79  $expected,
80  "Get/Set on passed failed, in/out not matching."
81  );
82  }
Mark $ass_mark
Definition: MarkTest.php:34
withPassed(bool $passed)
Definition: Mark.php:90
+ Here is the call graph for this function:

◆ testGetWithShortName()

MarkTest::testGetWithShortName ( )

Basic Get/Set test on member short name using accessor methods.

Definition at line 47 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getShortName(), and ILIAS\Test\Scoring\Marks\Mark\withShortName().

48  {
49  // Arrange
50  $expected = "Esther";
51  $ass_mark = $this->ass_mark->withShortName($expected);
52 
53  // Act
54  $actual = $ass_mark->getShortName();
55 
56  // Assert
57  $this->assertEquals(
58  $actual,
59  $expected,
60  "Get/Set on shortName failed, in/out not matching."
61  );
62  }
Mark $ass_mark
Definition: MarkTest.php:34
withShortName(string $short_name)
Definition: Mark.php:50
+ Here is the call graph for this function:

◆ testWithMinimumLevel_High()

MarkTest::testWithMinimumLevel_High ( )

Set test on member minimumLevel using accessor method with a high level.

Tested method should accept double according to docblock at getMinimumLevel(). Confusingly, setMinimumLevel states that it accepts strings as param, which can be considered an oversight of the author.

Todo:

Enhance documentation of class.assMark.php::setMinimumLevel();

Enhance documentation of class.assMark.php::getMinimumLevel();

Definition at line 134 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getMinimumLevel(), and ILIAS\Test\Scoring\Marks\Mark\withMinimumLevel().

135  {
136  // Arrange
137  $expected = 100;
138  $ass_mark = $this->ass_mark->withMinimumLevel($expected);
139 
140  // Act
141  $actual = $ass_mark->getMinimumLevel();
142 
143  // Assert
144  $this->assertEquals(
145  $actual,
146  $expected,
147  "Set low on minimumLevel failed, in/out not matching."
148  );
149  }
withMinimumLevel(float $minimum_level)
Definition: Mark.php:74
Mark $ass_mark
Definition: MarkTest.php:34
+ Here is the call graph for this function:

◆ testWithMinimumLevel_Low()

MarkTest::testWithMinimumLevel_Low ( )

Set test on member minimumLevel using accessor methods with a very low level.

See also
testSetMinimumLevel_High()

Definition at line 156 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getMinimumLevel(), and ILIAS\Test\Scoring\Marks\Mark\withMinimumLevel().

157  {
158  // Arrange
159  $expected = 1E-14;
160  $ass_mark = $this->ass_mark->withMinimumLevel($expected);
161 
162  // Act
163  $actual = $ass_mark->getMinimumLevel();
164 
165  // Assert
166  $this->assertEquals(
167  $actual,
168  $expected,
169  "Set low on minimumLevel failed, in/out not matching."
170  );
171  }
withMinimumLevel(float $minimum_level)
Definition: Mark.php:74
Mark $ass_mark
Definition: MarkTest.php:34
+ Here is the call graph for this function:

◆ testWithMinimumLevel_TooLow()

MarkTest::testWithMinimumLevel_TooLow ( )

Set test on member minimumLevel using accessor methods with a too low level.

See also
testSetMinimumLevel_High()

Definition at line 178 of file MarkTest.php.

References ILIAS\Test\Scoring\Marks\Mark\getMinimumLevel(), and ILIAS\Test\Scoring\Marks\Mark\withMinimumLevel().

179  {
180  $this->expectException(Exception::class);
181 
182  // Arrange
183  $expected = -1;
184  $ass_mark = $this->ass_mark->withMinimumLevel($expected);
185 
186  // Act
187  $actual = $ass_mark->getMinimumLevel();
188  }
withMinimumLevel(float $minimum_level)
Definition: Mark.php:74
Mark $ass_mark
Definition: MarkTest.php:34
+ Here is the call graph for this function:

Field Documentation

◆ $ass_mark

Mark MarkTest::$ass_mark
protected

Definition at line 34 of file MarkTest.php.

◆ $backupGlobals

MarkTest::$backupGlobals = false
protected

Definition at line 32 of file MarkTest.php.


The documentation for this class was generated from the following file: