ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
19  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20  ilUnitUtil::performInitialisation();
21  }
22  else
23  {
24  chdir( dirname( __FILE__ ) );
25  chdir('../../../');
26  }
27  }
28 
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  }
39 
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  }
54 
55  public function test_isTrue_shouldReturnTrue()
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  }
69 
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  }
84 
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  }
104 
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  }
119 
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  }
134 }