ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assAnswerMatchingTest Class Reference

Unit tests. More...

+ Inheritance diagram for assAnswerMatchingTest:
+ Collaboration diagram for assAnswerMatchingTest:

Public Member Functions

 test_instantiateObjectSimple ()
 
 test_setGetPoints ()
 
 test_setGetTermId ()
 
 test_setGetPicture ()
 
 test_setGetPictureId ()
 
 test_setGetPictureId_NegativeShouldNotSetValue ()
 
 test_setGetDefinition ()
 
 test_setGetDefinitionId ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 11 of file assAnswerMatchingTest.php.

Member Function Documentation

◆ setUp()

assAnswerMatchingTest::setUp ( )
protected

Definition at line 15 of file assAnswerMatchingTest.php.

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 }

◆ test_instantiateObjectSimple()

assAnswerMatchingTest::test_instantiateObjectSimple ( )

Definition at line 26 of file assAnswerMatchingTest.php.

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 }
Class for matching question answers.

◆ test_setGetDefinition()

assAnswerMatchingTest::test_setGetDefinition ( )

Definition at line 113 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetDefinitionId()

assAnswerMatchingTest::test_setGetDefinitionId ( )

Definition at line 128 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPicture()

assAnswerMatchingTest::test_setGetPicture ( )

Definition at line 68 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPictureId()

assAnswerMatchingTest::test_setGetPictureId ( )

Definition at line 83 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPictureId_NegativeShouldNotSetValue()

assAnswerMatchingTest::test_setGetPictureId_NegativeShouldNotSetValue ( )

Definition at line 98 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPoints()

assAnswerMatchingTest::test_setGetPoints ( )

Definition at line 38 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetTermId()

assAnswerMatchingTest::test_setGetTermId ( )

Definition at line 53 of file assAnswerMatchingTest.php.

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 }

Field Documentation

◆ $backupGlobals

assAnswerMatchingTest::$backupGlobals = false
protected

Definition at line 13 of file assAnswerMatchingTest.php.


The documentation for this class was generated from the following file: