ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assNumericRangeTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 protected $backupGlobals = FALSE;
14
15 protected function setUp()
16 {
17 if (defined('ILIAS_PHPUNIT_CONTEXT'))
18 {
19 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 ilUnitUtil::performInitialisation();
21 }
22 else
23 {
24 chdir( dirname( __FILE__ ) );
25 chdir('../../../');
26 }
27 }
28
30 {
31 // Arrange
32 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
33
34 // Act
35 $instance = new assNumericRange();
36
37 $this->assertInstanceOf('assNumericRange', $instance);
38 }
39
41 {
42 // Arrange
43 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
44 $instance = new assNumericRange();
45 $expected = 1.00;
46
47 // Act
48 $instance->setLowerLimit($expected);
49 $actual = $instance->getLowerLimit();
50
51 // Assert
52 $this->assertEquals($expected, $actual);
53 }
54
56 {
57 // Arrange
58 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
59 $instance = new assNumericRange();
60 $expected = 10.00;
61
62 // Act
63 $instance->setUpperLimit($expected);
64 $actual = $instance->getUpperLimit();
65
66 // Assert
67 $this->assertEquals($expected, $actual);
68 }
69
71 {
72 // Arrange
73 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
74 $instance = new assNumericRange();
75 $expected = 10;
76
77 // Act
78 $instance->setOrder($expected);
79 $actual = $instance->getOrder();
80
81 // Assert
82 $this->assertEquals($expected, $actual);
83 }
84
86 {
87 // Arrange
88 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
89 $instance = new assNumericRange();
90 $expected = 10;
91
92 // Act
93 $instance->setPoints($expected);
94 $actual = $instance->getPoints();
95
96 // Assert
97 $this->assertEquals($expected, $actual);
98 }
99
101 {
102 // Arrange
103 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
104 $instance = new assNumericRange();
105 $instance->setLowerLimit(1.00);
106 $instance->setUpperLimit(10.00);
107 $expected = true;
108
109 // Act
110 $actual = $instance->contains(5.00);
111
112 // Assert
113 $this->assertEquals($expected, $actual);
114 }
115
117 {
118 // Arrange
119 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
120 $instance = new assNumericRange();
121 $instance->setLowerLimit(1.00);
122 $instance->setUpperLimit(10.00);
123 $expected = false;
124
125 // Act
126 $actual = $instance->contains(15.00);
127
128 // Assert
129 $this->assertEquals($expected, $actual);
130 }
131
133 {
134 // Arrange
135 require_once './Modules/TestQuestionPool/classes/class.assNumericRange.php';
136 $instance = new assNumericRange();
137 $instance->setLowerLimit(1.00);
138 $instance->setUpperLimit(10.00);
139 $expected = false;
140
141 // Act
142 $actual = $instance->contains('Günther');
143
144 // Assert
145 $this->assertEquals($expected, $actual);
146 }
147}
test_setGetLowerLimit_shouldReturnUnchangedLowerLimit()
test_setGetUpperLimit_shouldReturnUnchangedUpperLimit()
test_contains_shouldReturnFalseIfValueIsNotContained()
Class for numeric ranges of questions.