ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 13 of file ilassMarkTest.php.

Member Function Documentation

◆ setUp()

ilassMarkTest::setUp ( )
protected

Definition at line 21 of file ilassMarkTest.php.

References defined.

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

◆ testGetSetMinimumLevel()

ilassMarkTest::testGetSetMinimumLevel ( )

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

Definition at line 99 of file ilassMarkTest.php.

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

◆ testGetSetOfficialName()

ilassMarkTest::testGetSetOfficialName ( )

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

Definition at line 79 of file ilassMarkTest.php.

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

◆ testGetSetPassed()

ilassMarkTest::testGetSetPassed ( )

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

Definition at line 59 of file ilassMarkTest.php.

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

◆ testGetSetShortName()

ilassMarkTest::testGetSetShortName ( )

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

Definition at line 39 of file ilassMarkTest.php.

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

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

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

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

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

◆ testSetMinimumLevel_TooLow()

ilassMarkTest::testSetMinimumLevel_TooLow ( )

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

Exception

See also
testSetMinimumLevel_High()

Definition at line 175 of file ilassMarkTest.php.

176  {
177  // Arrange
178  $expected = -1;
179  $this->ass_mark->setMinimumLevel($expected);
180 
181  // Act
182  $actual = $this->ass_mark->getMinimumLevel();
183  }

Field Documentation

◆ $ass_mark

ilassMarkTest::$ass_mark
protected

Definition at line 19 of file ilassMarkTest.php.

◆ $backupGlobals

ilassMarkTest::$backupGlobals = false
protected

Definition at line 16 of file ilassMarkTest.php.


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