ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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  // Act
39  $instance = new assAnswerErrorText('errortext');
40 
41  // Assert
42  $this->assertInstanceOf(assAnswerErrorText::class, $instance);
43  }
44 
45 
46  public function test_instantiateObjectFull(): void
47  {
48  // Act
49  $instance = new assAnswerErrorText(
50  'errortext',
51  'correcttext',
52  0.01,
53  21
54  );
55 
56  // Assert
57  $this->assertInstanceOf(assAnswerErrorText::class, $instance);
58  }
59 
61  {
62  $instance = new assAnswerErrorText(
63  'errortext',
64  'correcttext',
65  0.01,
66  21
67  );
68 
69  $this->assertInstanceOf(assAnswerErrorText::class, $instance);
70  $this->assertEquals('errortext', $instance->getTextWrong());
71  $this->assertEquals('correcttext', $instance->getTextCorrect());
72  $this->assertEquals(0.01, $instance->getPoints());
73  $this->assertEquals(21, $instance->getPosition());
74  $this->assertEquals(1, $instance->getLength());
75  }
76 
77  public function test_withPoints_valid(): void
78  {
79  $instance = new assAnswerErrorText('errortext');
80  $expected = 0.01;
81 
82  // Act
83  $instance_with_points = $instance->withPoints($expected);
84  $actual = $instance_with_points->getPoints();
85 
86  // Assert
87  $this->assertEquals($actual, $expected);
88  }
89 
90  public function test_withPosition_valid(): void
91  {
92  $instance = new assAnswerErrorText('errortext');
93  $expected = 21;
94 
95  // Act
96  $instance_with_position = $instance->withPosition($expected);
97  $actual = $instance_with_position->getPosition();
98 
99  // Assert
100  $this->assertEquals($actual, $expected);
101  }
102 }
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...