ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilassMarkTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
34 {
35  protected $backupGlobals = FALSE;
36 
37  protected function setUp()
38  {
39  if (defined('ILIAS_PHPUNIT_CONTEXT'))
40  {
41  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
42  ilUnitUtil::performInitialisation();
43  }
44  else
45  {
46  chdir( dirname( __FILE__ ) );
47  chdir('../../../');
48  }
49  // Arrange
50  include_once './Modules/Test/classes/class.assMark.php';
51  $this->ass_mark = new ASS_Mark();
52  }
53 
57  public function testGetSetShortName()
58  {
59  // Arrange
60  $expected = "Esther";
61  $this->ass_mark->setShortName($expected);
62 
63  // Act
64  $actual = $this->ass_mark->getShortName();
65 
66  // Assert
67  $this->assertEquals(
68  $actual,
69  $expected,
70  "Get/Set on shortName failed, in/out not matching."
71  );
72  }
73 
77  public function testGetSetPassed()
78  {
79  // Arrange
80  $expected = 1;
81  $this->ass_mark->setPassed($expected);
82 
83  // Act
84  $actual = $this->ass_mark->getPassed();
85 
86  // Assert
87  $this->assertEquals(
88  $actual,
89  $expected,
90  "Get/Set on passed failed, in/out not matching."
91  );
92  }
93 
97  public function testGetSetOfficialName()
98  {
99  // Arrange
100  $expected = "Esther The Tester";
101  $this->ass_mark->setOfficialName($expected);
102 
103  // Act
104  $actual = $this->ass_mark->getOfficialName();
105 
106  // Assert
107  $this->assertEquals(
108  $actual,
109  $expected,
110  "Get/Set on officialName failed, in/out not matching."
111  );
112  }
113 
117  public function testGetSetMinimumLevel()
118  {
119  // Arrange
120  $expected = 50;
121  $this->ass_mark->setMinimumLevel($expected);
122 
123  // Act
124  $actual = $this->ass_mark->getMinimumLevel();
125 
126  // Assert
127  $this->assertEquals(
128  $actual,
129  $expected,
130  "Get/Set on minimumLevel failed, in/out not matching."
131  );
132  }
133 
146  public function testSetMinimumLevel_High()
147  {
148  // Arrange
149  $expected = 100;
150  $this->ass_mark->setMinimumLevel($expected);
151 
152  // Act
153  $actual = $this->ass_mark->getMinimumLevel();
154 
155  // Assert
156  $this->assertEquals(
157  $actual,
158  $expected,
159  "Set low on minimumLevel failed, in/out not matching."
160  );
161  }
162 
169  public function testSetMinimumLevel_Low()
170  {
171  // Arrange
172  $expected = 1E-14;
173  $this->ass_mark->setMinimumLevel($expected);
174 
175  // Act
176  $actual = $this->ass_mark->getMinimumLevel();
177 
178  // Assert
179  $this->assertEquals(
180  $actual,
181  $expected,
182  "Set low on minimumLevel failed, in/out not matching."
183  );
184  }
185 }