ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 27 of file ilassMarkTest.php.

Member Function Documentation

◆ setUp()

ilassMarkTest::setUp ( )
protected

Definition at line 35 of file ilassMarkTest.php.

35  : void
36  {
37  chdir(dirname(__FILE__));
38  chdir('../../../');
39 
40 
41  // Arrange
42  require_once './Modules/Test/classes/class.assMark.php';
43  $this->ass_mark = new ASS_Mark();
44  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testGetSetMinimumLevel()

ilassMarkTest::testGetSetMinimumLevel ( )

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

Definition at line 109 of file ilassMarkTest.php.

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

◆ testGetSetOfficialName()

ilassMarkTest::testGetSetOfficialName ( )

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

Definition at line 89 of file ilassMarkTest.php.

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

◆ testGetSetPassed()

ilassMarkTest::testGetSetPassed ( )

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

Definition at line 69 of file ilassMarkTest.php.

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

◆ testGetSetShortName()

ilassMarkTest::testGetSetShortName ( )

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

Definition at line 49 of file ilassMarkTest.php.

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

◆ 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 136 of file ilassMarkTest.php.

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

◆ 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 158 of file ilassMarkTest.php.

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

◆ 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 180 of file ilassMarkTest.php.

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

Field Documentation

◆ $ass_mark

ASS_Mark ilassMarkTest::$ass_mark
protected

Definition at line 33 of file ilassMarkTest.php.

◆ $backupGlobals

ilassMarkTest::$backupGlobals = false
protected

Definition at line 30 of file ilassMarkTest.php.


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