ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
25  require_once './Services/PHPUnit/classes/class.ilUnitUtil.php';
26  ilUnitUtil::performInitialisation();
27  }
28  else
29  {
30  chdir( dirname( __FILE__ ) );
31  chdir('../../../');
32  }
33 
34  // Arrange
35  require_once './Modules/Test/classes/class.assMark.php';
36  $this->ass_mark = new ASS_Mark();
37  }
38 
42  public function testGetSetShortName()
43  {
44  // Arrange
45  $expected = "Esther";
46  $this->ass_mark->setShortName($expected);
47 
48  // Act
49  $actual = $this->ass_mark->getShortName();
50 
51  // Assert
52  $this->assertEquals(
53  $actual,
54  $expected,
55  "Get/Set on shortName failed, in/out not matching."
56  );
57  }
58 
62  public function testGetSetPassed()
63  {
64  // Arrange
65  $expected = 1;
66  $this->ass_mark->setPassed($expected);
67 
68  // Act
69  $actual = $this->ass_mark->getPassed();
70 
71  // Assert
72  $this->assertEquals(
73  $actual,
74  $expected,
75  "Get/Set on passed failed, in/out not matching."
76  );
77  }
78 
82  public function testGetSetOfficialName()
83  {
84  // Arrange
85  $expected = "Esther The Tester";
86  $this->ass_mark->setOfficialName($expected);
87 
88  // Act
89  $actual = $this->ass_mark->getOfficialName();
90 
91  // Assert
92  $this->assertEquals(
93  $actual,
94  $expected,
95  "Get/Set on officialName failed, in/out not matching."
96  );
97  }
98 
102  public function testGetSetMinimumLevel()
103  {
104  // Arrange
105  $expected = 50;
106  $this->ass_mark->setMinimumLevel($expected);
107 
108  // Act
109  $actual = $this->ass_mark->getMinimumLevel();
110 
111  // Assert
112  $this->assertEquals(
113  $actual,
114  $expected,
115  "Get/Set on minimumLevel failed, in/out not matching."
116  );
117  }
118 
131  public function testSetMinimumLevel_High()
132  {
133  // Arrange
134  $expected = 100;
135  $this->ass_mark->setMinimumLevel($expected);
136 
137  // Act
138  $actual = $this->ass_mark->getMinimumLevel();
139 
140  // Assert
141  $this->assertEquals(
142  $actual,
143  $expected,
144  "Set low on minimumLevel failed, in/out not matching."
145  );
146  }
147 
154  public function testSetMinimumLevel_Low()
155  {
156  // Arrange
157  $expected = 1E-14;
158  $this->ass_mark->setMinimumLevel($expected);
159 
160  // Act
161  $actual = $this->ass_mark->getMinimumLevel();
162 
163  // Assert
164  $this->assertEquals(
165  $actual,
166  $expected,
167  "Set low on minimumLevel failed, in/out not matching."
168  );
169  }
170 
178  public function testSetMinimumLevel_TooLow()
179  {
180  // Arrange
181  $expected = -1;
182  $this->ass_mark->setMinimumLevel($expected);
183 
184  // Act
185  $actual = $this->ass_mark->getMinimumLevel();
186  }
187 }