ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
assAnswerMatchingTest.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $backupGlobals = false;
29 
30  protected function setUp(): void
31  {
32  chdir(dirname(__FILE__));
33  chdir('../../../');
34  }
35 
36  public function test_instantiateObjectSimple(): void
37  {
38  // Arrange
39  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
40 
41  // Act
42  $instance = new ASS_AnswerMatching();
43 
44  // Assert
45  $this->assertInstanceOf('ASS_AnswerMatching', $instance);
46  }
47 
48  public function test_setGetPoints(): void
49  {
50  // Arrange
51  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
52  $instance = new ASS_AnswerMatching();
53  $expected = 10;
54 
55  // Act
56  $instance->setPoints($expected);
57  $actual = $instance->getPoints();
58 
59  // Assert
60  $this->assertEquals($expected, $actual);
61  }
62 
63  public function test_setGetTermId(): void
64  {
65  // Arrange
66  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
67  $instance = new ASS_AnswerMatching();
68  $expected = 10;
69 
70  // Act
71  $instance->setTermId($expected);
72  $actual = $instance->getTermId();
73 
74  // Assert
75  $this->assertEquals($expected, $actual);
76  }
77 
78  public function test_setGetPicture(): void
79  {
80  // Arrange
81  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
82  $instance = new ASS_AnswerMatching();
83  $expected = '/link/to/image?';
84 
85  // Act
86  $instance->setPicture($expected);
87  $actual = $instance->getPicture();
88 
89  // Assert
90  $this->assertEquals($expected, $actual);
91  }
92 
93  public function test_setGetPictureId(): void
94  {
95  // Arrange
96  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
97  $instance = new ASS_AnswerMatching();
98  $expected = 47;
99 
100  // Act
101  $instance->setPictureId($expected);
102  $actual = $instance->getPictureId();
103 
104  // Assert
105  $this->assertEquals($expected, $actual);
106  }
107 
109  {
110  // Arrange
111  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
112  $instance = new ASS_AnswerMatching();
113  $expected = 0;
114 
115  // Act
116  $instance->setPictureId(-47);
117  $actual = $instance->getPictureId();
118 
119  // Assert
120  $this->assertEquals($expected, $actual);
121  }
122 
123  public function test_setGetDefinition(): void
124  {
125  // Arrange
126  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
127  $instance = new ASS_AnswerMatching();
128  $expected = 'Definition is this.';
129 
130  // Act
131  $instance->setDefinition($expected);
132  $actual = $instance->getDefinition();
133 
134  // Assert
135  $this->assertEquals($expected, $actual);
136  }
137 
138  public function test_setGetDefinitionId(): void
139  {
140  // Arrange
141  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatching.php';
142  $instance = new ASS_AnswerMatching();
143  $expected = 10;
144 
145  // Act
146  $instance->setDefinitionId($expected);
147  $actual = $instance->getDefinitionId();
148 
149  // Assert
150  $this->assertEquals($expected, $actual);
151  }
152 }
Class assBaseTestCase.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...