ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assNumericRangeTest Class Reference

Unit tests. More...

+ Inheritance diagram for assNumericRangeTest:
+ Collaboration diagram for assNumericRangeTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_setGetLowerLimit_shouldReturnUnchangedLowerLimit ()
 
 test_setGetUpperLimit_shouldReturnUnchangedUpperLimit ()
 
 test_setGetOrder_shouldReturnUnchangedOrder ()
 
 test_setPoints_shouldReturnUnchangedPoints ()
 
 test_contains_shouldReturnTrueIfValueIsContained ()
 
 test_contains_shouldReturnFalseIfValueIsNotContained ()
 
 test_contains_shouldReturnFalseIfValueIsHokum ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests.

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

Definition at line 11 of file assNumericRangeTest.php.

Member Function Documentation

◆ setUp()

assNumericRangeTest::setUp ( )
protected

Definition at line 15 of file assNumericRangeTest.php.

References defined.

16  {
17  if (defined('ILIAS_PHPUNIT_CONTEXT')) {
18  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19  ilUnitUtil::performInitialisation();
20  } else {
21  chdir(dirname(__FILE__));
22  chdir('../../../');
23  }
24  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ test_contains_shouldReturnFalseIfValueIsHokum()

assNumericRangeTest::test_contains_shouldReturnFalseIfValueIsHokum ( )

Definition at line 129 of file assNumericRangeTest.php.

130  {
131  // Arrange
132  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
133  $instance = new assNumericRange();
134  $instance->setLowerLimit(1.00);
135  $instance->setUpperLimit(10.00);
136  $expected = false;
137 
138  // Act
139  $actual = $instance->contains('Günther');
140 
141  // Assert
142  $this->assertEquals($expected, $actual);
143  }
Class for numeric ranges of questions.

◆ test_contains_shouldReturnFalseIfValueIsNotContained()

assNumericRangeTest::test_contains_shouldReturnFalseIfValueIsNotContained ( )

Definition at line 113 of file assNumericRangeTest.php.

114  {
115  // Arrange
116  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
117  $instance = new assNumericRange();
118  $instance->setLowerLimit(1.00);
119  $instance->setUpperLimit(10.00);
120  $expected = false;
121 
122  // Act
123  $actual = $instance->contains(15.00);
124 
125  // Assert
126  $this->assertEquals($expected, $actual);
127  }
Class for numeric ranges of questions.

◆ test_contains_shouldReturnTrueIfValueIsContained()

assNumericRangeTest::test_contains_shouldReturnTrueIfValueIsContained ( )

Definition at line 97 of file assNumericRangeTest.php.

98  {
99  // Arrange
100  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
101  $instance = new assNumericRange();
102  $instance->setLowerLimit(1.00);
103  $instance->setUpperLimit(10.00);
104  $expected = true;
105 
106  // Act
107  $actual = $instance->contains(5.00);
108 
109  // Assert
110  $this->assertEquals($expected, $actual);
111  }
Class for numeric ranges of questions.

◆ test_instantiateObject_shouldReturnInstance()

assNumericRangeTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 26 of file assNumericRangeTest.php.

27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
30 
31  // Act
32  $instance = new assNumericRange();
33 
34  $this->assertInstanceOf('assNumericRange', $instance);
35  }
Class for numeric ranges of questions.

◆ test_setGetLowerLimit_shouldReturnUnchangedLowerLimit()

assNumericRangeTest::test_setGetLowerLimit_shouldReturnUnchangedLowerLimit ( )

Definition at line 37 of file assNumericRangeTest.php.

38  {
39  // Arrange
40  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
41  $instance = new assNumericRange();
42  $expected = 1.00;
43 
44  // Act
45  $instance->setLowerLimit($expected);
46  $actual = $instance->getLowerLimit();
47 
48  // Assert
49  $this->assertEquals($expected, $actual);
50  }
Class for numeric ranges of questions.

◆ test_setGetOrder_shouldReturnUnchangedOrder()

assNumericRangeTest::test_setGetOrder_shouldReturnUnchangedOrder ( )

Definition at line 67 of file assNumericRangeTest.php.

68  {
69  // Arrange
70  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
71  $instance = new assNumericRange();
72  $expected = 10;
73 
74  // Act
75  $instance->setOrder($expected);
76  $actual = $instance->getOrder();
77 
78  // Assert
79  $this->assertEquals($expected, $actual);
80  }
Class for numeric ranges of questions.

◆ test_setGetUpperLimit_shouldReturnUnchangedUpperLimit()

assNumericRangeTest::test_setGetUpperLimit_shouldReturnUnchangedUpperLimit ( )

Definition at line 52 of file assNumericRangeTest.php.

53  {
54  // Arrange
55  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
56  $instance = new assNumericRange();
57  $expected = 10.00;
58 
59  // Act
60  $instance->setUpperLimit($expected);
61  $actual = $instance->getUpperLimit();
62 
63  // Assert
64  $this->assertEquals($expected, $actual);
65  }
Class for numeric ranges of questions.

◆ test_setPoints_shouldReturnUnchangedPoints()

assNumericRangeTest::test_setPoints_shouldReturnUnchangedPoints ( )

Definition at line 82 of file assNumericRangeTest.php.

83  {
84  // Arrange
85  require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
86  $instance = new assNumericRange();
87  $expected = 10;
88 
89  // Act
90  $instance->setPoints($expected);
91  $actual = $instance->getPoints();
92 
93  // Assert
94  $this->assertEquals($expected, $actual);
95  }
Class for numeric ranges of questions.

Field Documentation

◆ $backupGlobals

assNumericRangeTest::$backupGlobals = false
protected

Definition at line 13 of file assNumericRangeTest.php.


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