ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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(__DIR__ . '/../../../../');
33 }
34
35 public function test_instantiateObjectSimple(): void
36 {
37 $instance = new assAnswerErrorText('errortext');
38
39 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
40 }
41
42
43 public function test_instantiateObjectFull(): void
44 {
45 $instance = new assAnswerErrorText(
46 'errortext',
47 'correcttext',
48 0.01,
49 21,
50 );
51
52 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
53 }
54
56 {
57 $instance = new assAnswerErrorText(
58 'errortext',
59 'correcttext',
60 0.01,
61 21,
62 );
63
64 $this->assertInstanceOf(assAnswerErrorText::class, $instance);
65 $this->assertEquals('errortext', $instance->getTextWrong());
66 $this->assertEquals('correcttext', $instance->getTextCorrect());
67 $this->assertEquals(0.01, $instance->getPoints());
68 $this->assertEquals(21, $instance->getPosition());
69 $this->assertEquals(1, $instance->getLength());
70 }
71
72 public function test_withPoints_valid(): void
73 {
74 $instance = new assAnswerErrorText('errortext');
75 $expected = 0.01;
76
77 $instance_with_points = $instance->withPoints($expected);
78 $actual = $instance_with_points->getPoints();
79
80 $this->assertEquals($actual, $expected);
81 }
82
83 public function test_withPosition_valid(): void
84 {
85 $instance = new assAnswerErrorText('errortext');
86 $expected = 21;
87
88 $instance_with_position = $instance->withPosition($expected);
89 $actual = $instance_with_position->getPosition();
90
91 $this->assertEquals($actual, $expected);
92 }
93}
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.