ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19  ilUnitUtil::performInitialisation();
20  } else {
21  chdir(dirname(__FILE__));
22  chdir('../../../');
23  }
24  }
25 
26  public function test_instantiateObjectSimple()
27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
30 
31  // Act
32  $instance = new ASS_AnswerMatching();
33 
34  // Assert
35  $this->assertInstanceOf('ASS_AnswerMatching', $instance);
36  }
37 
38  public function test_setGetPoints()
39  {
40  // Arrange
41  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
42  $instance = new ASS_AnswerMatching();
43  $expected = 10;
44 
45  // Act
46  $instance->setPoints($expected);
47  $actual = $instance->getPoints();
48 
49  // Assert
50  $this->assertEquals($expected, $actual);
51  }
52 
53  public function test_setGetTermId()
54  {
55  // Arrange
56  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
57  $instance = new ASS_AnswerMatching();
58  $expected = 10;
59 
60  // Act
61  $instance->setTermId($expected);
62  $actual = $instance->getTermId();
63 
64  // Assert
65  $this->assertEquals($expected, $actual);
66  }
67 
68  public function test_setGetPicture()
69  {
70  // Arrange
71  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
72  $instance = new ASS_AnswerMatching();
73  $expected = '/link/to/image?';
74 
75  // Act
76  $instance->setPicture($expected);
77  $actual = $instance->getPicture();
78 
79  // Assert
80  $this->assertEquals($expected, $actual);
81  }
82 
83  public function test_setGetPictureId()
84  {
85  // Arrange
86  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
87  $instance = new ASS_AnswerMatching();
88  $expected = 47;
89 
90  // Act
91  $instance->setPictureId($expected);
92  $actual = $instance->getPictureId();
93 
94  // Assert
95  $this->assertEquals($expected, $actual);
96  }
97 
99  {
100  // Arrange
101  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
102  $instance = new ASS_AnswerMatching();
103  $expected = 0;
104 
105  // Act
106  $instance->setPictureId(-47);
107  $actual = $instance->getPictureId();
108 
109  // Assert
110  $this->assertEquals($expected, $actual);
111  }
112 
113  public function test_setGetDefinition()
114  {
115  // Arrange
116  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
117  $instance = new ASS_AnswerMatching();
118  $expected = 'Definition is this.';
119 
120  // Act
121  $instance->setDefinition($expected);
122  $actual = $instance->getDefinition();
123 
124  // Assert
125  $this->assertEquals($expected, $actual);
126  }
127 
128  public function test_setGetDefinitionId()
129  {
130  // Arrange
131  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
132  $instance = new ASS_AnswerMatching();
133  $expected = 10;
134 
135  // Act
136  $instance->setDefinitionId($expected);
137  $actual = $instance->getDefinitionId();
138 
139  // Assert
140  $this->assertEquals($expected, $actual);
141  }
142 }
Class for matching question answers.