ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilQTIResponseTest.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(ilQTIResponse::class, new ilQTIResponse());
28  }
29 
30  public function testSetGetIdent(): void
31  {
32  $instance = new ilQTIResponse();
33  $instance->setIdent('Some input.');
34  $this->assertEquals('Some input.', $instance->getIdent());
35  }
36 
37  #[\PHPUnit\Framework\Attributes\DataProvider('rtimings')]
38  public function testSetGetRtiming(string $input, ?string $expected): void
39  {
40  $instance = new ilQTIResponse();
41  $instance->setRtiming($input);
42  $this->assertEquals($expected, $instance->getRtiming());
43  }
44 
45  #[\PHPUnit\Framework\Attributes\DataProvider('numtypes')]
46  public function testSetGetNumtype(string $input, ?string $expected): void
47  {
48  $instance = new ilQTIResponse();
49  $instance->setNumtype($input);
50  $this->assertEquals($expected, $instance->getNumtype());
51  }
52 
53  public static function rtimings(): array
54  {
55  class_exists(ilQTIResponse::class); // Force autoload to define the constants.
56 
57  return [
62  ['Random input.', null],
63  ];
64  }
65 
66  public static function numtypes(): array
67  {
68  class_exists(ilQTIResponse::class); // Force autoload to define the constants.
69  return [
70  ['integer', ilQTIResponse::NUMTYPE_INTEGER],
72  ['decimal', ilQTIResponse::NUMTYPE_DECIMAL],
74  ['scientific', ilQTIResponse::NUMTYPE_SCIENTIFIC],
76  ['Random input.', null],
77  ];
78  }
79 }
testSetGetRtiming(string $input, ?string $expected)
testSetGetNumtype(string $input, ?string $expected)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null