ILIAS  release_8 Revision v8.24
assAnswerErrorTextTest.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
36 public function test_instantiateObjectSimple(): void
37 {
38 // Arrange
39 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
40
41 // Act
42 $instance = new assAnswerErrorText('errortext');
43
44 // Assert
45 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
46 }
47
48
49 public function test_instantiateObjectFull(): void
50 {
51 // Arrange
52 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
53
54 // Act
55 $instance = new assAnswerErrorText(
56 'errortext',
57 'correcttext',
58 0.01,
59 21
60 );
61
62 // Assert
63 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
64 }
65
67 {
68
69 $instance = new assAnswerErrorText(
70 'errortext',
71 'correcttext',
72 0.01,
73 21
74 );
75
76 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
77 $this->assertEquals('errortext', $instance->getTextWrong());
78 $this->assertEquals('correcttext', $instance->getTextCorrect());
79 $this->assertEquals(0.01, $instance->getPoints());
80 $this->assertEquals(21, $instance->getPosition());
81 $this->assertEquals(1, $instance->getLength());
82 }
83
84 public function test_withPoints_valid(): void
85 {
86 //$this->markTestIncomplete('Testing an uncommitted feature.');
87 // Arrange
88 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
89 $instance = new assAnswerErrorText('errortext');
90 $expected = 0.01;
91
92 // Act
93 $instance_with_points = $instance->withPoints($expected);
94 $actual = $instance_with_points->getPoints();
95
96 // Assert
97 $this->assertEquals($actual, $expected);
98 }
99
100 public function test_withPosition_valid(): void
101 {
102 //$this->markTestIncomplete('Testing an uncommitted feature.');
103 // Arrange
104 require_once './Modules/TestQuestionPool/classes/class.assAnswerErrorText.php';
105 $instance = new assAnswerErrorText('errortext');
106 $expected = 21;
107
108 // Act
109 $instance_with_position = $instance->withPosition($expected);
110 $actual = $instance_with_position->getPosition();
111
112 // Assert
113 $this->assertEquals($actual, $expected);
114 }
115}
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...
Class assBaseTestCase.