ILIAS  release_8 Revision v8.24
ilQTISetvarTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22use PHPUnit\Framework\TestCase;
23
24class ilQTISetvarTest extends TestCase
25{
26 public function testConstruct(): void
27 {
28 $this->assertInstanceOf(ilQTISetvar::class, new ilQTISetvar());
29 }
30
34 public function testSetGetAction(string $input, ?string $expected): void
35 {
36 $instance = new ilQTISetvar();
37 $instance->setAction($input);
38 $this->assertEquals($expected, $instance->getAction());
39 }
40
41 public function testSetGetContent(): void
42 {
43 $instance = new ilQTISetvar();
44 $instance->setContent('Some input.');
45 $this->assertEquals('Some input.', $instance->getContent());
46 }
47
48 public function testSetGetVarname(): void
49 {
50 $instance = new ilQTISetvar();
51 $instance->setVarname('Some input.');
52 $this->assertEquals('Some input.', $instance->getVarname());
53 }
54
55 public function actions(): array
56 {
57 class_exists(ilQTISetvar::class); // Force autoload to define the constants.
58 return [
63 ['subtract', ilQTISetvar::ACTION_SUBTRACT],
65 ['multiply', ilQTISetvar::ACTION_MULTIPLY],
69 ['6', null],
70 ['Some input.', null],
71 ];
72 }
73}
testSetGetAction(string $input, ?string $expected)
@dataProvider actions