ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
PCContentIncludeTest Class Reference
+ Inheritance diagram for PCContentIncludeTest:
+ Collaboration diagram for PCContentIncludeTest:

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testCreateSingleUsesSelectedId ()
 
 testContentId ()
 
 testContentType ()
 
 testInstId ()
 
 testCollectContentIncludes ()
 

Additional Inherited Members

- Protected Member Functions inherited from COPageTestBase
 setGlobalVariable (string $name, $value)
 
 setUp ()
 
 getIdGeneratorMock ()
 
 getPCDefinition ()
 
 setPCIdCnt (int $cnt)
 
 getIDManager (\ilPageObject $page)
 
 insertParagraphAt (\ilPageObject $page, string $hier_id, string $text="")
 
 tearDown ()
 
 normalize (string $html)
 
 assertXmlEquals (string $expected_xml_as_string, string $html_xml_string)
 
 getEmptyPageWithDom ()
 
 legacyHtmlToXml (string $content)
 
 getMediaObjectMock ()
 
- Protected Attributes inherited from COPageTestBase
int $pc_cnt
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file PCContentIncludeTest.php.

Member Function Documentation

◆ testCollectContentIncludes()

PCContentIncludeTest::testCollectContentIncludes ( )

Definition at line 133 of file PCContentIncludeTest.php.

133 : void
134 {
135 $page = $this->getEmptyPageWithDom();
136 $pc = new ilPCContentInclude($page);
137 $pc->create($page, "pg");
138 $pc->setInstId("123");
139 $pc->setContentType("type");
140 $pc->setContentId(55);
141
142 $includes = ilPCContentInclude::collectContentIncludes($page, $page->getDomDoc());
143
144 $this->assertEquals(
145 ['type:55:123' => [
146 "type" => "type",
147 "id" => "55",
148 "inst_id" => "123"
149 ]],
150 $includes
151 );
152 }
Class ilPCContentInclude.
static collectContentIncludes(ilPageObject $a_page, DOMDocument $a_domdoc)
get all content includes that are used within the page

References $page, ilPCContentInclude\collectContentIncludes(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testConstruction()

PCContentIncludeTest::testConstruction ( )

Definition at line 26 of file PCContentIncludeTest.php.

26 : void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc = new ilPCContentInclude($page);
30 $this->assertEquals(
31 ilPCContentInclude::class,
32 get_class($pc)
33 );
34 }

References $page, and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testContentId()

PCContentIncludeTest::testContentId ( )

Definition at line 67 of file PCContentIncludeTest.php.

67 : void
68 {
69 $page = $this->getEmptyPageWithDom();
70 $pc = new ilPCContentInclude($page);
71 $pc->create($page, "pg");
72 $pc->setContentId("10");
73
74 $this->assertEquals(
75 "10",
76 $pc->getContentId()
77 );
78
79 $expected = <<<EOT
80<PageObject HierId="pg"><PageContent><ContentInclude ContentId="10"></ContentInclude></PageContent></PageObject>
81EOT;
82
83 $this->assertXmlEquals(
84 $expected,
85 $page->getXMLFromDom()
86 );
87 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)

References $page, COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testContentType()

PCContentIncludeTest::testContentType ( )

Definition at line 89 of file PCContentIncludeTest.php.

89 : void
90 {
91 $page = $this->getEmptyPageWithDom();
92 $pc = new ilPCContentInclude($page);
93 $pc->create($page, "pg");
94 $pc->setContentType("type");
95
96 $this->assertEquals(
97 "type",
98 $pc->getContentType()
99 );
100
101 $expected = <<<EOT
102<PageObject HierId="pg"><PageContent><ContentInclude ContentType="type"></ContentInclude></PageContent></PageObject>
103EOT;
104
105 $this->assertXmlEquals(
106 $expected,
107 $page->getXMLFromDom()
108 );
109 }

References $page, COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCContentIncludeTest::testCreate ( )

Definition at line 36 of file PCContentIncludeTest.php.

36 : void
37 {
38 $page = $this->getEmptyPageWithDom();
39 $pc = new ilPCContentInclude($page);
40 $pc->create($page, "pg");
41 $this->assertXmlEquals(
42 '<PageObject HierId="pg"><PageContent><ContentInclude></ContentInclude></PageContent></PageObject>',
43 $page->getXMLFromDom()
44 );
45 }

References $page, COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreateSingleUsesSelectedId()

PCContentIncludeTest::testCreateSingleUsesSelectedId ( )

Definition at line 47 of file PCContentIncludeTest.php.

47 : void
48 {
49 $gui = new class () extends ilPCContentIncludeGUI {
50 public ?array $created_ids = null;
51
52 public function __construct()
53 {
54 }
55
56 public function create(?array $ids = null): void
57 {
58 $this->created_ids = $ids;
59 }
60 };
61
62 $gui->createSingle(123);
63
64 $this->assertSame([123], $gui->created_ids);
65 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

◆ testInstId()

PCContentIncludeTest::testInstId ( )

Definition at line 111 of file PCContentIncludeTest.php.

111 : void
112 {
113 $page = $this->getEmptyPageWithDom();
114 $pc = new ilPCContentInclude($page);
115 $pc->create($page, "pg");
116 $pc->setInstId("123");
117
118 $this->assertEquals(
119 "123",
120 $pc->getInstId()
121 );
122
123 $expected = <<<EOT
124<PageObject HierId="pg"><PageContent><ContentInclude InstId="123"></ContentInclude></PageContent></PageObject>
125EOT;
126
127 $this->assertXmlEquals(
128 $expected,
129 $page->getXMLFromDom()
130 );
131 }

References $page, COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: