ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilQTIMaterialTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
23class ilQTIMaterialTest extends TestCase
24{
25 public function testConstruct(): void
26 {
27 $this->assertInstanceOf(ilQTIMaterial::class, new ilQTIMaterial());
28 }
29
30 public function testAddMattext(): void
31 {
32 $instance = new ilQTIMaterial();
33 $text = $this->getMockBuilder(ilQTIMattext::class)->disableOriginalConstructor()->getMock();
34 $instance->addMattext($text);
35 $this->assertEquals([['material' => $text, 'type' => 'mattext']], $instance->materials);
36 }
37
38 public function testAddMatimage(): void
39 {
40 $instance = new ilQTIMaterial();
41 $image = $this->getMockBuilder(ilQTIMatimage::class)->disableOriginalConstructor()->getMock();
42 $instance->addMatimage($image);
43 $this->assertEquals([['material' => $image, 'type' => 'matimage']], $instance->materials);
44 }
45
46 public function testAddMatapplet(): void
47 {
48 $instance = new ilQTIMaterial();
49 $applet = $this->getMockBuilder(ilQTIMatapplet::class)->disableOriginalConstructor()->getMock();
50 $instance->addMatapplet($applet);
51 $this->assertEquals([['material' => $applet, 'type' => 'matapplet']], $instance->materials);
52 }
53
54 public function testSetGetFlow(): void
55 {
56 $instance = new ilQTIMaterial();
57
58 $this->assertEquals(0, $instance->getFlow());
59
60 $instance->setFlow(8);
61 $this->assertEquals(8, $instance->getFlow());
62 }
63
64 public function testSetGetLabel(): void
65 {
66 $instance = new ilQTIMaterial();
67
68 $this->assertEquals(null, $instance->getLabel());
69
70 $instance->setLabel('Some input.');
71 $this->assertEquals('Some input.', $instance->getLabel());
72 }
73}