ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assAnswerTrueFalseTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13  protected $backupGlobals = false;
14 
15  protected function setUp()
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  }
25 
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  }
36 
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  }
51 
52  public function test_isTrue_shouldReturnTrue()
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  }
66 
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  }
81 
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  }
101 
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  }
116 
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  }
131 }
test_setFalseGetCorrectness_shouldReturnFalse()
: Fix bug! getCorrectness returns int instead of bool.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
Class for true/false or yes/no answers.