ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilassMarkTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14{
16 protected $backupGlobals = false;
17
19 protected $ass_mark;
20
21 protected function setUp()
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 }
35
39 public function testGetSetShortName()
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 }
55
59 public function testGetSetPassed()
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 }
75
79 public function testGetSetOfficialName()
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 }
95
99 public function testGetSetMinimumLevel()
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 }
115
128 public function testSetMinimumLevel_High()
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 }
144
151 public function testSetMinimumLevel_Low()
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 }
167
176 {
177 // Arrange
178 $expected = -1;
179 $this->ass_mark->setMinimumLevel($expected);
180
181 // Act
182 $actual = $this->ass_mark->getMinimumLevel();
183 }
184}
A class defining marks for assessment test objects.
An exception for terminatinating execution or to throw for unit testing.
Unit tests for ASS_Mark.
testGetSetOfficialName()
Basic Get/Set test on member officialName using accessor methods.
testSetMinimumLevel_Low()
Set test on member minimumLevel using accessor methods with a very low level.
testGetSetShortName()
Basic Get/Set test on member short name using accessor methods.
testSetMinimumLevel_TooLow()
Set test on member minimumLevel using accessor methods with a too low level.
testSetMinimumLevel_High()
Set test on member minimumLevel using accessor method with a high level.
testGetSetMinimumLevel()
Basic Get/Set test on member minimumLevel using accessor methods.
testGetSetPassed()
Basic Get/Set test on member passed using accessor methods.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27