ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assAnswerTrueFalseTest Class Reference

Unit tests. More...

+ Inheritance diagram for assAnswerTrueFalseTest:
+ Collaboration diagram for assAnswerTrueFalseTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_setGetCorrectness_shouldReturnUnchangedState ()
 
 test_isTrue_shouldReturnTrue ()
 
 test_isFalse_shouldReturnFalseOnTrueState ()
 
 test_setFalseGetCorrectness_shouldReturnFalse ()
 : Fix bug! getCorrectness returns int instead of bool. More...
 
 test_setTrueIsTrue_shouldReturnUnchangedState ()
 
 test_setFalseIsFalse_shouldReturnUnchangedState ()
 

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 assAnswerTrueFalseTest.php.

Member Function Documentation

◆ setUp()

assAnswerTrueFalseTest::setUp ( )
protected

Definition at line 15 of file assAnswerTrueFalseTest.php.

References defined.

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

◆ test_instantiateObject_shouldReturnInstance()

assAnswerTrueFalseTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 26 of file assAnswerTrueFalseTest.php.

27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
30 
31  // Act
32  $instance = new ASS_AnswerTrueFalse();
33 
34  $this->assertInstanceOf('ASS_AnswerTrueFalse', $instance);
35  }
Class for true/false or yes/no answers.

◆ test_isFalse_shouldReturnFalseOnTrueState()

assAnswerTrueFalseTest::test_isFalse_shouldReturnFalseOnTrueState ( )

Definition at line 67 of file assAnswerTrueFalseTest.php.

68  {
69  // Arrange
70  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
71  $instance = new ASS_AnswerTrueFalse();
72  $expected = false;
73 
74  // Act
75  $instance->setCorrectness(true);
76 
77  // Assert
78  $this->assertEquals($expected, $instance->isFalse());
79  $this->assertEquals($expected, $instance->isIncorrect());
80  }
Class for true/false or yes/no answers.

◆ test_isTrue_shouldReturnTrue()

assAnswerTrueFalseTest::test_isTrue_shouldReturnTrue ( )

Definition at line 52 of file assAnswerTrueFalseTest.php.

53  {
54  // Arrange
55  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
56  $instance = new ASS_AnswerTrueFalse();
57  $expected = true;
58 
59  // Act
60  $instance->setCorrectness($expected);
61 
62  // Assert
63  $this->assertEquals($expected, $instance->isTrue());
64  $this->assertEquals($expected, $instance->isCorrect());
65  }
Class for true/false or yes/no answers.

◆ test_setFalseGetCorrectness_shouldReturnFalse()

assAnswerTrueFalseTest::test_setFalseGetCorrectness_shouldReturnFalse ( )

: Fix bug! getCorrectness returns int instead of bool.

Definition at line 85 of file assAnswerTrueFalseTest.php.

86  {
87  $this->markTestIncomplete('Bug detected, fix not applied yet due to poor coverage.');
88 
89  // Arrange
90  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
91  $instance = new ASS_AnswerTrueFalse();
92  $expected = false;
93 
94  // Act
95  $instance->setFalse();
96  $actual = $instance->getCorrectness();
97 
98  // Assert
99  $this->assertEquals($expected, $actual);
100  }
Class for true/false or yes/no answers.

◆ test_setFalseIsFalse_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setFalseIsFalse_shouldReturnUnchangedState ( )

Definition at line 117 of file assAnswerTrueFalseTest.php.

118  {
119  // Arrange
120  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
121  $instance = new ASS_AnswerTrueFalse();
122  $expected = true;
123 
124  // Act
125  $instance->setFalse();
126  $actual = $instance->isFalse();
127 
128  // Assert
129  $this->assertEquals($expected, $actual);
130  }
Class for true/false or yes/no answers.

◆ test_setGetCorrectness_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setGetCorrectness_shouldReturnUnchangedState ( )

Definition at line 37 of file assAnswerTrueFalseTest.php.

38  {
39  // Arrange
40  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
41  $instance = new ASS_AnswerTrueFalse();
42  $expected = true;
43 
44  // Act
45  $instance->setCorrectness($expected);
46  $actual = $instance->getCorrectness();
47 
48  // Assert
49  $this->assertEquals($expected, $actual);
50  }
Class for true/false or yes/no answers.

◆ test_setTrueIsTrue_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setTrueIsTrue_shouldReturnUnchangedState ( )

Definition at line 102 of file assAnswerTrueFalseTest.php.

103  {
104  // Arrange
105  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
106  $instance = new ASS_AnswerTrueFalse();
107  $expected = true;
108 
109  // Act
110  $instance->setTrue();
111  $actual = $instance->isTrue();
112 
113  // Assert
114  $this->assertEquals($expected, $actual);
115  }
Class for true/false or yes/no answers.

Field Documentation

◆ $backupGlobals

assAnswerTrueFalseTest::$backupGlobals = false
protected

Definition at line 13 of file assAnswerTrueFalseTest.php.


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