ILIAS  release_4-4 Revision
assAnswerImagemapTest.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 
29  public function test_instantiateObjectSimple()
30  {
31  // Arrange
32  require_once './Modules/TestQuestionPool/classes/class.assAnswerImagemap.php';
33 
34  // Act
35  $instance = new ASS_AnswerImagemap();
36 
37  // Assert
38  $this->assertInstanceOf('ASS_AnswerImagemap', $instance);
39  }
40 
41  public function test_setGetCoords()
42  {
43  // Arrange
44  require_once './Modules/TestQuestionPool/classes/class.assAnswerImagemap.php';
45  $instance = new ASS_AnswerImagemap();
46 
47  // Act
48  $expected = "12345";
49  $instance->setCoords($expected);
50  $actual = $instance->getCoords();
51 
52  // Assert
53  $this->assertEquals($expected, $actual);
54  }
55 
56  public function test_setGetArea()
57  {
58  // Arrange
59  require_once './Modules/TestQuestionPool/classes/class.assAnswerImagemap.php';
60  $instance = new ASS_AnswerImagemap();
61 
62  // Act
63  $expected = "12345";
64  $instance->setArea($expected);
65  $actual = $instance->getArea();
66 
67  // Assert
68  $this->assertEquals($expected, $actual);
69  }
70 
71  public function test_setGetPointsUnchecked()
72  {
73  // Arrange
74  require_once './Modules/TestQuestionPool/classes/class.assAnswerImagemap.php';
75  $instance = new ASS_AnswerImagemap();
76 
77  // Act
78  $expected = "12345";
79  $instance->setPointsUnchecked($expected);
80  $actual = $instance->getPointsUnchecked();
81 
82  // Assert
83  $this->assertEquals($expected, $actual);
84  }
85 
87  {
88  // Arrange
89  require_once './Modules/TestQuestionPool/classes/class.assAnswerImagemap.php';
90  $instance = new ASS_AnswerImagemap();
91 
92  // Act
93  $expected = 0.0;
94  $instance->setPointsUnchecked('Günther');
95  $actual = $instance->getPointsUnchecked();
96 
97  // Assert
98  $this->assertEquals($expected, $actual);
99  }
100 }
Class for true/false or yes/no answers.
test_setGetPointsUnchecked_shouldNullifyOnNonNumericPoints()