ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PCQuestionTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
20
25{
26 public function testConstruction(): void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc = new ilPCQuestion($page);
30 $this->assertEquals(
31 ilPCQuestion::class,
32 get_class($pc)
33 );
34 }
35
36 public function testCreate(): void
37 {
38 $page = $this->getEmptyPageWithDom();
39 $pc = new ilPCQuestion($page);
40 $pc->create($page, "pg", "");
41 $this->assertXmlEquals(
42 '<PageObject HierId="pg"><PageContent><Question QRef=""></Question></PageContent></PageObject>',
43 $page->getXMLFromDom()
44 );
45 }
46
47 public function testQuestionReference(): void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc = new ilPCQuestion($page);
51 $pc->create($page, "pg", "");
52 $pc->setQuestionReference("qref1");
53
54 $this->assertEquals(
55 "qref1",
56 $pc->getQuestionReference()
57 );
58
59 $page->stripHierIDs();
60
61 $expected = <<<EOT
62<PageObject><PageContent><Question QRef="qref1"></Question></PageContent></PageObject>
63EOT;
64 $this->assertXmlEquals(
65 $expected,
66 $page->getXMLFromDom()
67 );
68 }
69}
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...