ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 

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

Member Function Documentation

◆ setUp()

ilassMarkTest::setUp ( )
protected

Definition at line 23 of file ilassMarkTest.php.

23  : void
24  {
25  if (defined('ILIAS_PHPUNIT_CONTEXT')) {
26  require_once './Services/PHPUnit/classes/class.ilUnitUtil.php';
27  ilUnitUtil::performInitialisation();
28  } else {
29  chdir(dirname(__FILE__));
30  chdir('../../../');
31  }
32 
33  // Arrange
34  require_once './Modules/Test/classes/class.assMark.php';
35  $this->ass_mark = new ASS_Mark();
36  }
A class defining marks for assessment test objects.

◆ testGetSetMinimumLevel()

ilassMarkTest::testGetSetMinimumLevel ( )

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

Definition at line 101 of file ilassMarkTest.php.

102  {
103  // Arrange
104  $expected = 50;
105  $this->ass_mark->setMinimumLevel($expected);
106 
107  // Act
108  $actual = $this->ass_mark->getMinimumLevel();
109 
110  // Assert
111  $this->assertEquals(
112  $actual,
113  $expected,
114  "Get/Set on minimumLevel failed, in/out not matching."
115  );
116  }

◆ testGetSetOfficialName()

ilassMarkTest::testGetSetOfficialName ( )

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

Definition at line 81 of file ilassMarkTest.php.

82  {
83  // Arrange
84  $expected = "Esther The Tester";
85  $this->ass_mark->setOfficialName($expected);
86 
87  // Act
88  $actual = $this->ass_mark->getOfficialName();
89 
90  // Assert
91  $this->assertEquals(
92  $actual,
93  $expected,
94  "Get/Set on officialName failed, in/out not matching."
95  );
96  }

◆ testGetSetPassed()

ilassMarkTest::testGetSetPassed ( )

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

Definition at line 61 of file ilassMarkTest.php.

62  {
63  // Arrange
64  $expected = 1;
65  $this->ass_mark->setPassed($expected);
66 
67  // Act
68  $actual = $this->ass_mark->getPassed();
69 
70  // Assert
71  $this->assertEquals(
72  $actual,
73  $expected,
74  "Get/Set on passed failed, in/out not matching."
75  );
76  }

◆ testGetSetShortName()

ilassMarkTest::testGetSetShortName ( )

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

Definition at line 41 of file ilassMarkTest.php.

42  {
43  // Arrange
44  $expected = "Esther";
45  $this->ass_mark->setShortName($expected);
46 
47  // Act
48  $actual = $this->ass_mark->getShortName();
49 
50  // Assert
51  $this->assertEquals(
52  $actual,
53  $expected,
54  "Get/Set on shortName failed, in/out not matching."
55  );
56  }

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

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

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

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

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

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

Field Documentation

◆ $ass_mark

ilassMarkTest::$ass_mark
protected

Definition at line 21 of file ilassMarkTest.php.

◆ $backupGlobals

ilassMarkTest::$backupGlobals = false
protected

Definition at line 18 of file ilassMarkTest.php.


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