ILIAS  release_8 Revision v8.24
assAnswerErrorTextTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 test_instantiateObjectSimple ()
 
 test_instantiateObjectFull ()
 
 test_instantiateObjectFullHasCorrectValues ()
 
 test_withPoints_valid ()
 
 test_withPosition_valid ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from assBaseTestCase
 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 

Protected Attributes

 $backupGlobals = false
 
- Protected Attributes inherited from assBaseTestCase
Container $dic = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Unit tests for assAnswerErrorTextTest

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

Definition at line 26 of file assAnswerErrorTextTest.php.

Member Function Documentation

◆ setUp()

assAnswerErrorTextTest::setUp ( )
protected

Reimplemented from assBaseTestCase.

Definition at line 30 of file assAnswerErrorTextTest.php.

30 : void
31 {
32 chdir(dirname(__FILE__));
33 chdir('../../../');
34 }

◆ test_instantiateObjectFull()

assAnswerErrorTextTest::test_instantiateObjectFull ( )

Definition at line 49 of file assAnswerErrorTextTest.php.

49 : void
50 {
51 // Arrange
52 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
53
54 // Act
55 $instance = new assAnswerErrorText(
56 'errortext',
57 'correcttext',
58 0.01,
59 21
60 );
61
62 // Assert
63 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
64 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_instantiateObjectFullHasCorrectValues()

assAnswerErrorTextTest::test_instantiateObjectFullHasCorrectValues ( )

Definition at line 66 of file assAnswerErrorTextTest.php.

66 : void
67 {
68
69 $instance = new assAnswerErrorText(
70 'errortext',
71 'correcttext',
72 0.01,
73 21
74 );
75
76 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
77 $this->assertEquals('errortext', $instance->getTextWrong());
78 $this->assertEquals('correcttext', $instance->getTextCorrect());
79 $this->assertEquals(0.01, $instance->getPoints());
80 $this->assertEquals(21, $instance->getPosition());
81 $this->assertEquals(1, $instance->getLength());
82 }

◆ test_instantiateObjectSimple()

assAnswerErrorTextTest::test_instantiateObjectSimple ( )

Definition at line 36 of file assAnswerErrorTextTest.php.

36 : void
37 {
38 // Arrange
39 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
40
41 // Act
42 $instance = new assAnswerErrorText('errortext');
43
44 // Assert
45 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
46 }

◆ test_withPoints_valid()

assAnswerErrorTextTest::test_withPoints_valid ( )

Definition at line 84 of file assAnswerErrorTextTest.php.

84 : void
85 {
86 //$this->markTestIncomplete('Testing an uncommitted feature.');
87 // Arrange
88 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
89 $instance = new assAnswerErrorText('errortext');
90 $expected = 0.01;
91
92 // Act
93 $instance_with_points = $instance->withPoints($expected);
94 $actual = $instance_with_points->getPoints();
95
96 // Assert
97 $this->assertEquals($actual, $expected);
98 }

◆ test_withPosition_valid()

assAnswerErrorTextTest::test_withPosition_valid ( )

Definition at line 100 of file assAnswerErrorTextTest.php.

100 : void
101 {
102 //$this->markTestIncomplete('Testing an uncommitted feature.');
103 // Arrange
104 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
105 $instance = new assAnswerErrorText('errortext');
106 $expected = 21;
107
108 // Act
109 $instance_with_position = $instance->withPosition($expected);
110 $actual = $instance_with_position->getPosition();
111
112 // Assert
113 $this->assertEquals($actual, $expected);
114 }

Field Documentation

◆ $backupGlobals

assAnswerErrorTextTest::$backupGlobals = false
protected

Definition at line 28 of file assAnswerErrorTextTest.php.


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