ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilassMarkTest Class Reference

Unit tests for ASS_Mark. More...

+ Inheritance diagram for ilassMarkTest:
+ Collaboration diagram for ilassMarkTest:

Public Member Functions

 testGetSetShortName ()
 Basic Get/Set test on member short name using accessor methods. More...
 
 testGetSetPassed ()
 Basic Get/Set test on member passed using accessor methods. More...
 
 testGetSetOfficialName ()
 Basic Get/Set test on member officialName using accessor methods. More...
 
 testGetSetMinimumLevel ()
 Basic Get/Set test on member minimumLevel using accessor methods. More...
 
 testSetMinimumLevel_High ()
 Set test on member minimumLevel using accessor method with a high level. More...
 
 testSetMinimumLevel_Low ()
 Set test on member minimumLevel using accessor methods with a very low level. More...
 
 testSetMinimumLevel_TooLow ()
 Set test on member minimumLevel using accessor methods with a too low level. More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 
ASS_Mark $ass_mark
 

Detailed Description

Unit tests for ASS_Mark.

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

Definition at line 29 of file ilassMarkTest.php.

Member Function Documentation

◆ setUp()

ilassMarkTest::setUp ( )
protected

Definition at line 37 of file ilassMarkTest.php.

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

◆ testGetSetMinimumLevel()

ilassMarkTest::testGetSetMinimumLevel ( )

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

Definition at line 108 of file ilassMarkTest.php.

109  {
110  // Arrange
111  $expected = 50;
112  $this->ass_mark->setMinimumLevel($expected);
113 
114  // Act
115  $actual = $this->ass_mark->getMinimumLevel();
116 
117  // Assert
118  $this->assertEquals(
119  $actual,
120  $expected,
121  "Get/Set on minimumLevel failed, in/out not matching."
122  );
123  }

◆ testGetSetOfficialName()

ilassMarkTest::testGetSetOfficialName ( )

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

Definition at line 88 of file ilassMarkTest.php.

89  {
90  // Arrange
91  $expected = "Esther The Tester";
92  $this->ass_mark->setOfficialName($expected);
93 
94  // Act
95  $actual = $this->ass_mark->getOfficialName();
96 
97  // Assert
98  $this->assertEquals(
99  $actual,
100  $expected,
101  "Get/Set on officialName failed, in/out not matching."
102  );
103  }

◆ testGetSetPassed()

ilassMarkTest::testGetSetPassed ( )

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

Definition at line 68 of file ilassMarkTest.php.

69  {
70  // Arrange
71  $expected = 1;
72  $this->ass_mark->setPassed($expected);
73 
74  // Act
75  $actual = $this->ass_mark->getPassed();
76 
77  // Assert
78  $this->assertEquals(
79  $actual,
80  $expected,
81  "Get/Set on passed failed, in/out not matching."
82  );
83  }

◆ testGetSetShortName()

ilassMarkTest::testGetSetShortName ( )

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

Definition at line 48 of file ilassMarkTest.php.

49  {
50  // Arrange
51  $expected = "Esther";
52  $this->ass_mark->setShortName($expected);
53 
54  // Act
55  $actual = $this->ass_mark->getShortName();
56 
57  // Assert
58  $this->assertEquals(
59  $actual,
60  $expected,
61  "Get/Set on shortName failed, in/out not matching."
62  );
63  }

◆ testSetMinimumLevel_High()

ilassMarkTest::testSetMinimumLevel_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 135 of file ilassMarkTest.php.

136  {
137  // Arrange
138  $expected = 100;
139  $this->ass_mark->setMinimumLevel($expected);
140 
141  // Act
142  $actual = $this->ass_mark->getMinimumLevel();
143 
144  // Assert
145  $this->assertEquals(
146  $actual,
147  $expected,
148  "Set low on minimumLevel failed, in/out not matching."
149  );
150  }

◆ testSetMinimumLevel_Low()

ilassMarkTest::testSetMinimumLevel_Low ( )

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

See also
testSetMinimumLevel_High()

Definition at line 157 of file ilassMarkTest.php.

158  {
159  // Arrange
160  $expected = 1E-14;
161  $this->ass_mark->setMinimumLevel($expected);
162 
163  // Act
164  $actual = $this->ass_mark->getMinimumLevel();
165 
166  // Assert
167  $this->assertEquals(
168  $actual,
169  $expected,
170  "Set low on minimumLevel failed, in/out not matching."
171  );
172  }

◆ testSetMinimumLevel_TooLow()

ilassMarkTest::testSetMinimumLevel_TooLow ( )

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

See also
testSetMinimumLevel_High()

Definition at line 179 of file ilassMarkTest.php.

180  {
181  $this->expectException(Exception::class);
182 
183  // Arrange
184  $expected = -1;
185  $this->ass_mark->setMinimumLevel($expected);
186 
187  // Act
188  $actual = $this->ass_mark->getMinimumLevel();
189  }

Field Documentation

◆ $ass_mark

ASS_Mark ilassMarkTest::$ass_mark
protected

Definition at line 35 of file ilassMarkTest.php.

◆ $backupGlobals

ilassMarkTest::$backupGlobals = false
protected

Definition at line 32 of file ilassMarkTest.php.


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