ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
19 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 ilUnitUtil::performInitialisation();
21 }
22 else
23 {
24 chdir( dirname( __FILE__ ) );
25 chdir('../../../');
26 }
27 }

◆ test_instantiateObjectSimple()

assAnswerMatchingTest::test_instantiateObjectSimple ( )

Definition at line 29 of file assAnswerMatchingTest.php.

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

◆ test_setGetDefinition()

assAnswerMatchingTest::test_setGetDefinition ( )

Definition at line 116 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetDefinitionId()

assAnswerMatchingTest::test_setGetDefinitionId ( )

Definition at line 131 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPicture()

assAnswerMatchingTest::test_setGetPicture ( )

Definition at line 71 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPictureId()

assAnswerMatchingTest::test_setGetPictureId ( )

Definition at line 86 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPictureId_NegativeShouldNotSetValue()

assAnswerMatchingTest::test_setGetPictureId_NegativeShouldNotSetValue ( )

Definition at line 101 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetPoints()

assAnswerMatchingTest::test_setGetPoints ( )

Definition at line 41 of file assAnswerMatchingTest.php.

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 }

◆ test_setGetTermId()

assAnswerMatchingTest::test_setGetTermId ( )

Definition at line 56 of file assAnswerMatchingTest.php.

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 }

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: