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

◆ test_instantiateObject_shouldReturnInstance()

assAnswerTrueFalseTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 29 of file assAnswerTrueFalseTest.php.

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

◆ test_isFalse_shouldReturnFalseOnTrueState()

assAnswerTrueFalseTest::test_isFalse_shouldReturnFalseOnTrueState ( )

Definition at line 70 of file assAnswerTrueFalseTest.php.

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

◆ test_isTrue_shouldReturnTrue()

assAnswerTrueFalseTest::test_isTrue_shouldReturnTrue ( )

Definition at line 55 of file assAnswerTrueFalseTest.php.

56  {
57  // Arrange
58  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
59  $instance = new ASS_AnswerTrueFalse();
60  $expected = true;
61 
62  // Act
63  $instance->setCorrectness($expected);
64 
65  // Assert
66  $this->assertEquals($expected, $instance->isTrue());
67  $this->assertEquals($expected, $instance->isCorrect());
68  }
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 88 of file assAnswerTrueFalseTest.php.

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

◆ test_setFalseIsFalse_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setFalseIsFalse_shouldReturnUnchangedState ( )

Definition at line 120 of file assAnswerTrueFalseTest.php.

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

◆ test_setGetCorrectness_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setGetCorrectness_shouldReturnUnchangedState ( )

Definition at line 40 of file assAnswerTrueFalseTest.php.

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

◆ test_setTrueIsTrue_shouldReturnUnchangedState()

assAnswerTrueFalseTest::test_setTrueIsTrue_shouldReturnUnchangedState ( )

Definition at line 105 of file assAnswerTrueFalseTest.php.

106  {
107  // Arrange
108  require_once './Modules/TestQuestionPool/classes/class.assAnswerTrueFalse.php';
109  $instance = new ASS_AnswerTrueFalse();
110  $expected = true;
111 
112  // Act
113  $instance->setTrue();
114  $actual = $instance->isTrue();
115 
116  // Assert
117  $this->assertEquals($expected, $actual);
118  }
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: