ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilQTIResponseVarTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function testConstruct(): void
26  {
27  $this->assertInstanceOf(ilQTIResponseVar::class, new ilQTIResponseVar('a'));
28  }
29 
30  public function testSetGetVartype(): void
31  {
32  $instance = new ilQTIResponseVar('a');
33  $instance->setVartype('Some input.');
34  $this->assertEquals('Some input.', $instance->getVartype());
35  }
36 
37  #[\PHPUnit\Framework\Attributes\DataProvider('cases')]
38  public function testSetGetCase(string $input, ?string $expected): void
39  {
40  $instance = new ilQTIResponseVar('a');
41  $instance->setCase($input);
42  $this->assertEquals($expected, $instance->getCase());
43  }
44 
45  public function testSetGetRespident(): void
46  {
47  $instance = new ilQTIResponseVar('a');
48  $instance->setRespident('Some input.');
49  $this->assertEquals('Some input.', $instance->getRespident());
50  }
51 
52  public function testSetGetIndex(): void
53  {
54  $instance = new ilQTIResponseVar('a');
55  $instance->setIndex('Some input.');
56  $this->assertEquals('Some input.', $instance->getIndex());
57  }
58 
59  #[\PHPUnit\Framework\Attributes\DataProvider('setMatches')]
60  public function testSetGetSetmatch(string $input, ?string $expected): void
61  {
62  $instance = new ilQTIResponseVar('a');
63  $instance->setSetmatch($input);
64  $this->assertEquals($expected, $instance->getSetmatch());
65  }
66 
67  #[\PHPUnit\Framework\Attributes\DataProvider('areaTypes')]
68  public function testSetGetAreatype(string $input, ?string $expected): void
69  {
70  $instance = new ilQTIResponseVar('a');
71  $instance->setAreatype($input);
72  $this->assertEquals($expected, $instance->getAreatype());
73  }
74 
75  public function testSetGetContent(): void
76  {
77  $instance = new ilQTIResponseVar('a');
78  $instance->setContent('Some input.');
79  $this->assertEquals('Some input.', $instance->getContent());
80  }
81 
82  public static function cases(): array
83  {
84  class_exists(ilQTIResponseVar::class); // Force autoload to define the constants.
85  return [
90  ];
91  }
92 
93  public static function setMatches(): array
94  {
95  class_exists(ilQTIRespcondition::class); // Force autoload to define the constants.
96  return [
101  ];
102  }
103 
104  public static function areaTypes(): array
105  {
106  class_exists(ilQTIRespcondition::class); // Force autoload to define the constants.
107  return [
114  ];
115  }
116 }
testSetGetCase(string $input, ?string $expected)
testSetGetSetmatch(string $input, ?string $expected)
testSetGetAreatype(string $input, ?string $expected)