ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerMatchingTest.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.assAnswerMatching.php';
33 
34  // Act
35  $instance = new ASS_AnswerMatching();
36 
37  // Assert
38  $this->assertInstanceOf('ASS_AnswerMatching',$instance);
39  }
40 
41  public function test_setGetPoints()
42  {
43  // Arrange
44  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
45  $instance = new ASS_AnswerMatching();
46  $expected = 10;
47 
48  // Act
49  $instance->setPoints($expected);
50  $actual = $instance->getPoints();
51 
52  // Assert
53  $this->assertEquals($expected,$actual);
54  }
55 
56  public function test_setGetTermId()
57  {
58  // Arrange
59  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
60  $instance = new ASS_AnswerMatching();
61  $expected = 10;
62 
63  // Act
64  $instance->setTermId($expected);
65  $actual = $instance->getTermId();
66 
67  // Assert
68  $this->assertEquals($expected,$actual);
69  }
70 
71  public function test_setGetPicture()
72  {
73  // Arrange
74  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
75  $instance = new ASS_AnswerMatching();
76  $expected = '/link/to/image?';
77 
78  // Act
79  $instance->setPicture($expected);
80  $actual = $instance->getPicture();
81 
82  // Assert
83  $this->assertEquals($expected,$actual);
84  }
85 
86  public function test_setGetPictureId()
87  {
88  // Arrange
89  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
90  $instance = new ASS_AnswerMatching();
91  $expected = 47;
92 
93  // Act
94  $instance->setPictureId($expected);
95  $actual = $instance->getPictureId();
96 
97  // Assert
98  $this->assertEquals($expected,$actual);
99  }
100 
102  {
103  // Arrange
104  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
105  $instance = new ASS_AnswerMatching();
106  $expected = 0;
107 
108  // Act
109  $instance->setPictureId(-47);
110  $actual = $instance->getPictureId();
111 
112  // Assert
113  $this->assertEquals($expected,$actual);
114  }
115 
116  public function test_setGetDefinition()
117  {
118  // Arrange
119  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
120  $instance = new ASS_AnswerMatching();
121  $expected = 'Definition is this.';
122 
123  // Act
124  $instance->setDefinition($expected);
125  $actual = $instance->getDefinition();
126 
127  // Assert
128  $this->assertEquals($expected,$actual);
129  }
130 
131  public function test_setGetDefinitionId()
132  {
133  // Arrange
134  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
135  $instance = new ASS_AnswerMatching();
136  $expected = 10;
137 
138  // Act
139  $instance->setDefinitionId($expected);
140  $actual = $instance->getDefinitionId();
141 
142  // Assert
143  $this->assertEquals($expected,$actual);
144  }
145 }