ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
assAnswerTrueFalseTest.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $backupGlobals = false;
29 
30  protected function setUp(): void
31  {
32  chdir(dirname(__FILE__));
33  chdir('../../../');
34  }
35 
37  {
38  // Act
39  $instance = new ASS_AnswerTrueFalse();
40 
41  $this->assertInstanceOf('ASS_AnswerTrueFalse', $instance);
42  }
43 
45  {
46  $instance = new ASS_AnswerTrueFalse();
47  $expected = true;
48 
49  // Act
50  $instance->setCorrectness($expected);
51  $actual = $instance->getCorrectness();
52 
53  // Assert
54  $this->assertEquals($expected, $actual);
55  }
56 
57  public function test_isTrue_shouldReturnTrue(): void
58  {
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  $instance = new ASS_AnswerTrueFalse();
73  $expected = false;
74 
75  // Act
76  $instance->setCorrectness(true);
77 
78  // Assert
79  $this->assertEquals($expected, $instance->isFalse());
80  $this->assertEquals($expected, $instance->isIncorrect());
81  }
82 
84  {
85  $instance = new ASS_AnswerTrueFalse();
86  $expected = false;
87 
88  // Act
89  $instance->setFalse();
90  $actual = $instance->getCorrectness();
91 
92  // Assert
93  $this->assertEquals((bool) $expected, (bool) $actual);
94  }
95 
97  {
98  $instance = new ASS_AnswerTrueFalse();
99  $expected = true;
100 
101  // Act
102  $instance->setTrue();
103  $actual = $instance->isTrue();
104 
105  // Assert
106  $this->assertEquals($expected, $actual);
107  }
108 
110  {
111  $instance = new ASS_AnswerTrueFalse();
112  $expected = true;
113 
114  // Act
115  $instance->setFalse();
116  $actual = $instance->isFalse();
117 
118  // Assert
119  $this->assertEquals($expected, $actual);
120  }
121 }
Class assBaseTestCase.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...