ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assAnswerErrorTextTest Class Reference

Unit tests for assAnswerErrorTextTest. More...

+ Inheritance diagram for assAnswerErrorTextTest:
+ Collaboration diagram for assAnswerErrorTextTest:

Public Member Functions

 test_instantiateObjectSimple ()
 
 test_instantiateObjectFull ()
 
 test_setGetPoints_valid ()
 
 test_setPoints_invalid ()
 
 test_setGetTextCorrect ()
 
 test_setGetTextWrong_valid ()
 
 test_setTextWrong_invalid ()
 
 test_setGetUnknown ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = FALSE
 

Detailed Description

Unit tests for assAnswerErrorTextTest.

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

Definition at line 11 of file assAnswerErrorTextTest.php.

Member Function Documentation

◆ setUp()

assAnswerErrorTextTest::setUp ( )
protected

Definition at line 15 of file assAnswerErrorTextTest.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_instantiateObjectFull()

assAnswerErrorTextTest::test_instantiateObjectFull ( )

Definition at line 42 of file assAnswerErrorTextTest.php.

43 {
44 // Arrange
45 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
46
47 // Act
48 $instance = new assAnswerErrorText(
49 'errortext',
50 'correcttext',
51 1
52 );
53
54 // Assert
55 $this->assertTrue(TRUE);
56 }
Class for error text answers.

◆ test_instantiateObjectSimple()

assAnswerErrorTextTest::test_instantiateObjectSimple ( )

Definition at line 29 of file assAnswerErrorTextTest.php.

30 {
31 // Arrange
32 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
33
34 // Act
35 $instance = new assAnswerErrorText('errortext');
36
37 // Assert
38 $this->assertTrue(TRUE);
39 }

◆ test_setGetPoints_valid()

assAnswerErrorTextTest::test_setGetPoints_valid ( )

Definition at line 58 of file assAnswerErrorTextTest.php.

59 {
60 //$this->markTestIncomplete('Testing an uncommitted feature.');
61 // Arrange
62 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
63 $instance = new assAnswerErrorText( 'errortext' );
64 $expected = 0.01;
65
66 // Act
67 $instance->points = $expected;
68 $actual = $instance->points;
69
70 // Assert
71 $this->assertEquals($actual, $expected);
72 }

◆ test_setGetTextCorrect()

assAnswerErrorTextTest::test_setGetTextCorrect ( )

Definition at line 88 of file assAnswerErrorTextTest.php.

89 {
90 // Arrange
91 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
92 $instance = new assAnswerErrorText( 'errortext' );
93 $expected = 'Correct text';
94
95 // Act
96 $instance->text_correct = $expected;
97 $actual = $instance->text_correct;
98
99 // Assert
100 $this->assertEquals($actual, $expected);
101 }

◆ test_setGetTextWrong_valid()

assAnswerErrorTextTest::test_setGetTextWrong_valid ( )

Definition at line 103 of file assAnswerErrorTextTest.php.

104 {
105 // Arrange
106 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
107 $instance = new assAnswerErrorText( 'errortext' );
108 $expected = 'Errortext';
109
110 // Act
111 $instance->text_wrong = $expected;
112 $actual = $instance->text_wrong;
113
114 // Assert
115 $this->assertEquals($actual, $expected);
116 }

◆ test_setGetUnknown()

assAnswerErrorTextTest::test_setGetUnknown ( )

Definition at line 133 of file assAnswerErrorTextTest.php.

134 {
135 // Arrange
136 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
137 $instance = new assAnswerErrorText( 'errortext' );
138 $expected = null;
139
140 // Act
141 $instance->undefined123 = 'No expectations';
142 $actual = $instance->undefined123;
143
144 // Assert
145 $this->assertEquals($expected, $actual);
146 }

◆ test_setPoints_invalid()

assAnswerErrorTextTest::test_setPoints_invalid ( )

Definition at line 74 of file assAnswerErrorTextTest.php.

75 {
76 // Arrange
77 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
78 $instance = new assAnswerErrorText( 'errortext' );
79 $expected = 'hokum';
80
81 // Act
82 $instance->points = $expected;
83 $actual = $instance->points;
84 // Assert
85 $this->assertEquals($expected, $actual);
86 }

◆ test_setTextWrong_invalid()

assAnswerErrorTextTest::test_setTextWrong_invalid ( )

Definition at line 118 of file assAnswerErrorTextTest.php.

119 {
120 // Arrange
121 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
122 $instance = new assAnswerErrorText( 'errortext' );
123 $expected = '';
124
125 // Act
126 $instance->text_wrong = $expected;
127 $actual = $instance->text_wrong;
128
129 // Assert
130 $this->assertEquals($expected, $actual);
131 }

Field Documentation

◆ $backupGlobals

assAnswerErrorTextTest::$backupGlobals = FALSE
protected

Definition at line 13 of file assAnswerErrorTextTest.php.


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