ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
20 } else {
21 chdir(dirname(__FILE__));
22 chdir('../../../');
23 }
24 }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

References defined.

◆ test_instantiateObjectFull()

assAnswerErrorTextTest::test_instantiateObjectFull ( )

Definition at line 39 of file assAnswerErrorTextTest.php.

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

◆ test_instantiateObjectSimple()

assAnswerErrorTextTest::test_instantiateObjectSimple ( )

Definition at line 26 of file assAnswerErrorTextTest.php.

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

◆ test_setGetPoints_valid()

assAnswerErrorTextTest::test_setGetPoints_valid ( )

Definition at line 55 of file assAnswerErrorTextTest.php.

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

◆ test_setGetTextCorrect()

assAnswerErrorTextTest::test_setGetTextCorrect ( )

Definition at line 85 of file assAnswerErrorTextTest.php.

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

◆ test_setGetTextWrong_valid()

assAnswerErrorTextTest::test_setGetTextWrong_valid ( )

Definition at line 100 of file assAnswerErrorTextTest.php.

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

◆ test_setGetUnknown()

assAnswerErrorTextTest::test_setGetUnknown ( )

Definition at line 130 of file assAnswerErrorTextTest.php.

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

◆ test_setPoints_invalid()

assAnswerErrorTextTest::test_setPoints_invalid ( )

Definition at line 71 of file assAnswerErrorTextTest.php.

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

◆ test_setTextWrong_invalid()

assAnswerErrorTextTest::test_setTextWrong_invalid ( )

Definition at line 115 of file assAnswerErrorTextTest.php.

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

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: