ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
assAnswerSimpleTest 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 assAnswerSimpleTest:
+ Collaboration diagram for assAnswerSimpleTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_setGetId_shouldReturnUnchangedId ()
 
 test_setGetAnswertext_shouldReturnUnchangedAnswertext ()
 
 test_setGetPoints_shouldReturnUnchangedPoints ()
 
 test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ()
 
 test_setGetOrder_shouldReturnUnchangedOrder ()
 

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

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

Definition at line 26 of file assAnswerSimpleTest.php.

Member Function Documentation

◆ setUp()

assAnswerSimpleTest::setUp ( )
protected

Definition at line 30 of file assAnswerSimpleTest.php.

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

◆ test_instantiateObject_shouldReturnInstance()

assAnswerSimpleTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 36 of file assAnswerSimpleTest.php.

36  : void
37  {
38  // Arrange
39  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
40 
41  // Act
42  $instance = new ASS_AnswerSimple();
43 
44  $this->assertInstanceOf('ASS_AnswerSimple', $instance);
45  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetAnswertext_shouldReturnUnchangedAnswertext()

assAnswerSimpleTest::test_setGetAnswertext_shouldReturnUnchangedAnswertext ( )

Definition at line 62 of file assAnswerSimpleTest.php.

62  : void
63  {
64  // Arrange
65  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
66  $instance = new ASS_AnswerSimple("", 0.0, 0, -1, 0);
67  $expected = 'The answer, of course, is 42.';
68 
69  // Act
70  $instance->setAnswertext($expected);
71  $actual = $instance->getAnswertext();
72 
73  // Assert
74  $this->assertEquals($expected, $actual);
75  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetId_shouldReturnUnchangedId()

assAnswerSimpleTest::test_setGetId_shouldReturnUnchangedId ( )

Definition at line 47 of file assAnswerSimpleTest.php.

47  : void
48  {
49  // Arrange
50  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
51  $instance = new ASS_AnswerSimple("", 0.0, 0, -1, 0);
52  $expected = 1;
53 
54  // Act
55  $instance->setId($expected);
56  $actual = $instance->getId();
57 
58  // Assert
59  $this->assertEquals($expected, $actual);
60  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetOrder_shouldReturnUnchangedOrder()

assAnswerSimpleTest::test_setGetOrder_shouldReturnUnchangedOrder ( )

Definition at line 109 of file assAnswerSimpleTest.php.

109  : void
110  {
111  // Arrange
112  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
113  $instance = new ASS_AnswerSimple("", 0.0, 0, -1, 0);
114  $expected = 42;
115 
116  // Act
117  $instance->setOrder($expected);
118  $actual = $instance->getOrder();
119 
120  // Assert
121  $this->assertEquals($expected, $actual);
122  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetPoints_shouldReturnUnchangedPoints()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedPoints ( )

Definition at line 77 of file assAnswerSimpleTest.php.

77  : void
78  {
79  // Arrange
80  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
81  $instance = new ASS_AnswerSimple("", 0.0, 0, -1, 0);
82  $expected = 42;
83 
84  // Act
85  $instance->setPoints($expected);
86  $actual = $instance->getPoints();
87 
88  // Assert
89  $this->assertEquals($expected, $actual);
90  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ( )

Definition at line 92 of file assAnswerSimpleTest.php.

92  : void
93  {
94  // Note: We want to get rid of this functionality in the class.
95 
96  // Arrange
97  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
98  $instance = new ASS_AnswerSimple();
99  $expected = 0.0;
100 
101  // Act
102  $instance->setPoints('Günther');
103  $actual = $instance->getPoints();
104 
105  // Assert
106  $this->assertEquals($expected, $actual);
107  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $backupGlobals

assAnswerSimpleTest::$backupGlobals = false
protected

Definition at line 28 of file assAnswerSimpleTest.php.


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