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

Public Member Functions

 testConstruction ()
 
 testModifyPageContentPostXslRendersPluginAfterEmptyPlugin ()
 
 testCreate ()
 
 testProperties ()
 
 testVersion ()
 
 testName ()
 

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 PCPluggedTest.php.

Member Function Documentation

◆ testConstruction()

PCPluggedTest::testConstruction ( )

Definition at line 26 of file PCPluggedTest.php.

26 : void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc = new ilPCPlugged($page);
30 $this->assertEquals(
31 ilPCPlugged::class,
32 get_class($pc)
33 );
34 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $page, and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCPluggedTest::testCreate ( )

Definition at line 95 of file PCPluggedTest.php.

95 : void
96 {
97 $page = $this->getEmptyPageWithDom();
98 $pc = new ilPCPlugged($page);
99 $pc->create($page, "pg", "", "MyPlugin", "1.0");
100 $this->assertXmlEquals(
101 '<PageObject HierId="pg"><PageContent><Plugged PluginName="MyPlugin" PluginVersion="1.0"></Plugged></PageContent></PageObject>',
102 $page->getXMLFromDom()
103 );
104 }
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:

◆ testModifyPageContentPostXslRendersPluginAfterEmptyPlugin()

PCPluggedTest::testModifyPageContentPostXslRendersPluginAfterEmptyPlugin ( )

Definition at line 36 of file PCPluggedTest.php.

36 : void
37 {
38 $page = $this->getEmptyPageWithDom();
39
40 $first_plugin_info = $this->createConfiguredStub(
41 ilPluginInfo::class,
42 [
43 "isActive" => true,
44 "getId" => "first_plugin",
45 ]
46 );
47 $second_plugin_info = $this->createConfiguredStub(
48 ilPluginInfo::class,
49 [
50 "isActive" => true,
51 "getId" => "second_plugin",
52 ]
53 );
54
55 $first_plugin_gui = $this->createStub(ilPageComponentPluginGUI::class);
56 $first_plugin_gui->method("getElementHTML")
57 ->willReturn("");
58 $first_plugin = $this->createStub(ilPageComponentPlugin::class);
59 $first_plugin->method("getUIClassInstance")
60 ->willReturn($first_plugin_gui);
61
62 $second_plugin_gui = $this->createStub(ilPageComponentPluginGUI::class);
63 $second_plugin_gui->method("getElementHTML")
64 ->willReturn("second plugin html");
65 $second_plugin = $this->createStub(ilPageComponentPlugin::class);
66 $second_plugin->method("getUIClassInstance")
67 ->willReturn($second_plugin_gui);
68
69 $component_repository = $this->createStub(ilComponentRepository::class);
70 $component_repository->method("getPluginByName")
71 ->willReturnMap([
72 ["First", $first_plugin_info],
73 ["Second", $second_plugin_info],
74 ]);
75 $this->setGlobalVariable("component.repository", $component_repository);
76
77 $component_factory = $this->createStub(ilComponentFactory::class);
78 $component_factory->method("getPlugin")
79 ->willReturnMap([
80 ["first_plugin", $first_plugin],
81 ["second_plugin", $second_plugin],
82 ]);
83 $this->setGlobalVariable("component.factory", $component_factory);
84
85 $pc = new ilPCPlugged($page);
86 $first_marker = "{{{{{Plugged<pl/>First<pl/>1.0}}}}}";
87 $second_marker = "{{{{{Plugged<pl/>Second<pl/>1.0}}}}}";
88
89 $this->assertEquals(
90 "second plugin html",
91 $pc->modifyPageContentPostXsl($first_marker . $second_marker, "presentation")
92 );
93 }
setGlobalVariable(string $name, $value)

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

+ Here is the call graph for this function:

◆ testName()

PCPluggedTest::testName ( )

Definition at line 158 of file PCPluggedTest.php.

158 : void
159 {
160 $page = $this->getEmptyPageWithDom();
161 $pc = new ilPCPlugged($page);
162 $pc->create($page, "pg", "", "MyPlugin", "1.0");
163 $pc->setPluginName("YourPlugin");
164
165 $this->assertEquals(
166 "YourPlugin",
167 $pc->getPluginName()
168 );
169
170 $page->stripHierIDs();
171
172 $expected = <<<EOT
173<PageObject><PageContent><Plugged PluginName="YourPlugin" PluginVersion="1.0"></Plugged></PageContent></PageObject>
174EOT;
175 $this->assertXmlEquals(
176 $expected,
177 $page->getXMLFromDom()
178 );
179 }

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

+ Here is the call graph for this function:

◆ testProperties()

PCPluggedTest::testProperties ( )

Definition at line 106 of file PCPluggedTest.php.

106 : void
107 {
108 $page = $this->getEmptyPageWithDom();
109 $pc = new ilPCPlugged($page);
110 $pc->create($page, "pg", "", "MyPlugin", "1.0");
111 $pc->setProperties([
112 "prop1" => "val1",
113 "prop2" => "val2",
114 ]);
115
116 $this->assertEquals(
117 [
118 "prop1" => "val1",
119 "prop2" => "val2",
120 ],
121 $pc->getProperties()
122 );
123
124 $page->stripHierIDs();
125
126 $expected = <<<EOT
127<PageObject><PageContent><Plugged PluginName="MyPlugin" PluginVersion="1.0"><PluggedProperty Name="prop1">val1</PluggedProperty><PluggedProperty Name="prop2">val2</PluggedProperty></Plugged></PageContent></PageObject>
128EOT;
129 $this->assertXmlEquals(
130 $expected,
131 $page->getXMLFromDom()
132 );
133 }

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

+ Here is the call graph for this function:

◆ testVersion()

PCPluggedTest::testVersion ( )

Definition at line 135 of file PCPluggedTest.php.

135 : void
136 {
137 $page = $this->getEmptyPageWithDom();
138 $pc = new ilPCPlugged($page);
139 $pc->create($page, "pg", "", "MyPlugin", "1.0");
140 $pc->setPluginVersion("2.0");
141
142 $this->assertEquals(
143 "2.0",
144 $pc->getPluginVersion()
145 );
146
147 $page->stripHierIDs();
148
149 $expected = <<<EOT
150<PageObject><PageContent><Plugged PluginName="MyPlugin" PluginVersion="2.0"></Plugged></PageContent></PageObject>
151EOT;
152 $this->assertXmlEquals(
153 $expected,
154 $page->getXMLFromDom()
155 );
156 }

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: