ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilQTIMattextTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
23class ilQTIMattextTest extends TestCase
24{
25 public function testConstruct(): void
26 {
27 $this->assertInstanceOf(ilQTIMattext::class, new ilQTIMattext());
28 }
29
30 public function testSetGetTexttype(): void
31 {
32 $instance = new ilQTIMattext();
33 $instance->setTexttype('Some input.');
34 $this->assertEquals('Some input.', $instance->getTexttype());
35 }
36
37 public function testSetGetLabel(): void
38 {
39 $instance = new ilQTIMattext();
40 $instance->setLabel('Some input.');
41 $this->assertEquals('Some input.', $instance->getLabel());
42 }
43
44 public function testSetGetCharset(): void
45 {
46 $instance = new ilQTIMattext();
47 $instance->setCharset('Some input.');
48 $this->assertEquals('Some input.', $instance->getCharset());
49 }
50
51 public function testSetGetUri(): void
52 {
53 $instance = new ilQTIMattext();
54 $instance->setUri('Some input.');
55 $this->assertEquals('Some input.', $instance->getUri());
56 }
57
58 #[\PHPUnit\Framework\Attributes\DataProvider('xmlSpaces')]
59 public function testSetGetXmlspace(string $input, ?string $expected): void
60 {
61 $instance = new ilQTIMattext();
62 $instance->setXmlspace($input);
63 $this->assertEquals($expected, $instance->getXmlspace());
64 }
65
66 public function testSetGetXmllang(): void
67 {
68 $instance = new ilQTIMattext();
69 $instance->setXmllang('Some input.');
70 $this->assertEquals('Some input.', $instance->getXmllang());
71 }
72
73 public function testSetGetEntityref(): void
74 {
75 $instance = new ilQTIMattext();
76 $instance->setEntityref('Some input.');
77 $this->assertEquals('Some input.', $instance->getEntityref());
78 }
79
80 public function testSetGetWidth(): void
81 {
82 $instance = new ilQTIMattext();
83 $instance->setWidth('Some input.');
84 $this->assertEquals('Some input.', $instance->getWidth());
85 }
86
87 public function testSetGetHeight(): void
88 {
89 $instance = new ilQTIMattext();
90 $instance->setHeight('Some input.');
91 $this->assertEquals('Some input.', $instance->getHeight());
92 }
93
94 public function testSetGetX0(): void
95 {
96 $instance = new ilQTIMattext();
97 $instance->setX0('Some input.');
98 $this->assertEquals('Some input.', $instance->getX0());
99 }
100
101 public function testSetGetY0(): void
102 {
103 $instance = new ilQTIMattext();
104 $instance->setY0('Some input.');
105 $this->assertEquals('Some input.', $instance->getY0());
106 }
107
108 public function testSetGetContent(): void
109 {
110 $instance = new ilQTIMattext();
111 $instance->setContent('Some input.');
112 $this->assertEquals('Some input.', $instance->getContent());
113 }
114
115 public static function xmlSpaces(): array
116 {
117 class_exists(ilQTIMattext::class); // Force autoload to define the constants.
118 return [
119 ['preserve', ilQTIMattext::SPACE_PRESERVE],
121 ['default', ilQTIMattext::SPACE_DEFAULT],
123 ['Random input', null],
124 ];
125 }
126}
testSetGetXmlspace(string $input, ?string $expected)