ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
PCFileListTest Class Reference
+ Inheritance diagram for PCFileListTest:
+ Collaboration diagram for PCFileListTest:

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testAppendItem ()
 
 testListTitle ()
 
 testFileList ()
 
 testDeleteFileItem ()
 
 testPositions ()
 
 testClasses ()
 
 testNewItemAfter ()
 
 testNewItemBefore ()
 
 testDeleteItem ()
 
 testMoveItemDown ()
 
 testMoveItemUp ()
 

Protected Member Functions

 getPageWithFileList ()
 
 getItemForHierId (ilPageObject $page, string $hier_id)
 
- 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 ()
 

Additional Inherited Members

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

Member Function Documentation

◆ getItemForHierId()

PCFileListTest::getItemForHierId ( ilPageObject  $page,
string  $hier_id 
)
protected

Definition at line 189 of file PCFileListTest.php.

190 {
191 $pc_id = $page->getPCIdForHierId($hier_id);
192 $cont_node = $page->getContentDomNode($hier_id);
193 $pc = new ilPCFileItem($page);
194 $pc->setDomNode($cont_node);
195 $pc->setHierId($hier_id);
196 $pc->setPcId($pc_id);
197 return $pc;
198 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContentDomNode(string $a_hier_id, string $a_pc_id="")
getPCIdForHierId(string $hier_id)

References ilPageObject\getContentDomNode(), and ilPageObject\getPCIdForHierId().

Referenced by testDeleteItem(), testMoveItemDown(), testMoveItemUp(), testNewItemAfter(), and testNewItemBefore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageWithFileList()

PCFileListTest::getPageWithFileList ( )
protected

Definition at line 176 of file PCFileListTest.php.

177 {
178 $page = $this->getEmptyPageWithDom();
179 $pc = new ilPCFileList($page);
180 $pc->create($page, "pg");
181 $pc->appendItem("10", "file_loc", "image/jpeg");
182 $pc->appendItem("20", "file_loc2", "image/png");
183 $page->addHierIDs();
184 $page->insertPCIds();
185 $pc->setHierId("1");
186 return $page;
187 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)

References COPageTestBase\getEmptyPageWithDom().

Referenced by testDeleteItem(), testMoveItemDown(), testMoveItemUp(), testNewItemAfter(), and testNewItemBefore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testAppendItem()

PCFileListTest::testAppendItem ( )

Definition at line 47 of file PCFileListTest.php.

47 : void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc = new ilPCFileList($page);
51 $pc->create($page, "pg");
52 $pc->appendItem("10", "file_loc", "image/jpeg");
53 $expected = <<<EOT
54<PageObject HierId="pg"><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"></Identifier><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem></FileList></PageContent></PageObject>
55EOT;
56
57 $this->assertXmlEquals(
58 $expected,
59 $page->getXMLFromDom()
60 );
61 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)

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

+ Here is the call graph for this function:

◆ testClasses()

PCFileListTest::testClasses ( )

Definition at line 148 of file PCFileListTest.php.

148 : void
149 {
150 $page = $this->getEmptyPageWithDom();
151 $pc = new ilPCFileList($page);
152 $pc->create($page, "pg");
153 $pc->appendItem("10", "file_loc", "image/jpeg");
154 $pc->appendItem("20", "file_loc2", "image/png");
155 $page->addHierIDs();
156 $pc->setHierId("1");
157 $pc->saveStyleClasses([
158 "1_1:" => "Class1",
159 "1_2:" => "Class2",
160 ]);
161 $classes = $pc->getAllClasses();
162
163 $this->assertEquals(
164 [
165 "1_1:" => "Class1",
166 "1_2:" => "Class2",
167 ],
168 $pc->getAllClasses()
169 );
170 }

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testConstruction()

PCFileListTest::testConstruction ( )

Definition at line 26 of file PCFileListTest.php.

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

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCFileListTest::testCreate ( )

Definition at line 36 of file PCFileListTest.php.

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

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

+ Here is the call graph for this function:

◆ testDeleteFileItem()

PCFileListTest::testDeleteFileItem ( )

Definition at line 109 of file PCFileListTest.php.

109 : void
110 {
111 $page = $this->getEmptyPageWithDom();
112 $pc = new ilPCFileList($page);
113 $pc->create($page, "pg");
114 $pc->appendItem("10", "file_loc", "image/jpeg");
115 $page->addHierIDs();
116 $pc->setHierId("1");
117 $pc->deleteFileItems(["1_1:"]);
118
119 $this->assertXmlEquals(
120 '<PageObject HierId="pg"><PageContent HierId="1"><FileList></FileList></PageContent></PageObject>',
121 $page->getXMLFromDom()
122 );
123 }

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

+ Here is the call graph for this function:

◆ testDeleteItem()

PCFileListTest::testDeleteItem ( )

Definition at line 236 of file PCFileListTest.php.

236 : void
237 {
238 $page = $this->getPageWithFileList();
239 $item = $this->getItemForHierId($page, "1_2");
240 $item->deleteItem();
241 $page->stripHierIDs();
242 $page->stripPCIDs();
243
244 $expected = <<<EOT
245<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"/><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem></FileList></PageContent></PageObject>
246EOT;
247
248 $this->assertXmlEquals(
249 $expected,
250 $page->getXMLFromDom()
251 );
252 }
getItemForHierId(ilPageObject $page, string $hier_id)

References COPageTestBase\assertXmlEquals(), getItemForHierId(), and getPageWithFileList().

+ Here is the call graph for this function:

◆ testFileList()

PCFileListTest::testFileList ( )

Definition at line 89 of file PCFileListTest.php.

89 : void
90 {
91 $page = $this->getEmptyPageWithDom();
92 $pc = new ilPCFileList($page);
93 $pc->create($page, "pg");
94 $pc->appendItem("10", "file_loc", "image/jpeg");
95 $page->addHierIDs();
96 $pc->setHierId("1");
97 $this->assertEquals(
98 [ 0 =>
99 ["entry" => "il__file_10",
100 "id" => "10",
101 "pc_id" => "",
102 "hier_id" => "1_1",
103 "class" => ""]
104 ],
105 $pc->getFileList()
106 );
107 }

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testListTitle()

PCFileListTest::testListTitle ( )

Definition at line 63 of file PCFileListTest.php.

63 : void
64 {
65 $page = $this->getEmptyPageWithDom();
66 $pc = new ilPCFileList($page);
67 $pc->create($page, "pg");
68 $pc->setListTitle("MyTitle", "en");
69 $expected = <<<EOT
70<PageObject HierId="pg"><PageContent><FileList><Title Language="en">MyTitle</Title></FileList></PageContent></PageObject>
71EOT;
72
73 $this->assertXmlEquals(
74 $expected,
75 $page->getXMLFromDom()
76 );
77
78 $this->assertEquals(
79 "MyTitle",
80 $pc->getListTitle()
81 );
82
83 $this->assertEquals(
84 "en",
85 $pc->getLanguage()
86 );
87 }
Title class.
Definition: Title.php:42

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

+ Here is the call graph for this function:

◆ testMoveItemDown()

PCFileListTest::testMoveItemDown ( )

Definition at line 254 of file PCFileListTest.php.

254 : void
255 {
256 $page = $this->getPageWithFileList();
257 $item = $this->getItemForHierId($page, "1_1");
258 $item->moveItemDown();
259 $page->stripHierIDs();
260 $page->stripPCIDs();
261
262 $expected = <<<EOT
263<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_20"/><Location Type="LocalFile">file_loc2</Location><Format>image/png</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"/><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem></FileList></PageContent></PageObject>
264EOT;
265
266 $this->assertXmlEquals(
267 $expected,
268 $page->getXMLFromDom()
269 );
270 }

References COPageTestBase\assertXmlEquals(), getItemForHierId(), and getPageWithFileList().

+ Here is the call graph for this function:

◆ testMoveItemUp()

PCFileListTest::testMoveItemUp ( )

Definition at line 272 of file PCFileListTest.php.

272 : void
273 {
274 $page = $this->getPageWithFileList();
275 $item = $this->getItemForHierId($page, "1_2");
276 $item->moveItemUp();
277 $page->stripHierIDs();
278 $page->stripPCIDs();
279
280 $expected = <<<EOT
281<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_20"/><Location Type="LocalFile">file_loc2</Location><Format>image/png</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"/><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem></FileList></PageContent></PageObject>
282EOT;
283
284 $this->assertXmlEquals(
285 $expected,
286 $page->getXMLFromDom()
287 );
288 }

References COPageTestBase\assertXmlEquals(), getItemForHierId(), and getPageWithFileList().

+ Here is the call graph for this function:

◆ testNewItemAfter()

PCFileListTest::testNewItemAfter ( )

Definition at line 200 of file PCFileListTest.php.

200 : void
201 {
202 $page = $this->getPageWithFileList();
203 $item = $this->getItemForHierId($page, "1_1");
204 $item->newItemAfter("30", "file_loc3", "image/gif");
205 $page->stripHierIDs();
206 $page->stripPCIDs();
207
208 $expected = <<<EOT
209<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"/><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_30"/><Location Type="LocalFile">file_loc3</Location><Format>image/gif</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_20"/><Location Type="LocalFile">file_loc2</Location><Format>image/png</Format></FileItem></FileList></PageContent></PageObject>
210EOT;
211
212 $this->assertXmlEquals(
213 $expected,
214 $page->getXMLFromDom()
215 );
216 }

References COPageTestBase\assertXmlEquals(), getItemForHierId(), and getPageWithFileList().

+ Here is the call graph for this function:

◆ testNewItemBefore()

PCFileListTest::testNewItemBefore ( )

Definition at line 218 of file PCFileListTest.php.

218 : void
219 {
220 $page = $this->getPageWithFileList();
221 $item = $this->getItemForHierId($page, "1_2");
222 $item->newItemBefore("30", "file_loc3", "image/gif");
223 $page->stripHierIDs();
224 $page->stripPCIDs();
225
226 $expected = <<<EOT
227<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"/><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_30"/><Location Type="LocalFile">file_loc3</Location><Format>image/gif</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_20"/><Location Type="LocalFile">file_loc2</Location><Format>image/png</Format></FileItem></FileList></PageContent></PageObject>
228EOT;
229
230 $this->assertXmlEquals(
231 $expected,
232 $page->getXMLFromDom()
233 );
234 }

References COPageTestBase\assertXmlEquals(), getItemForHierId(), and getPageWithFileList().

+ Here is the call graph for this function:

◆ testPositions()

PCFileListTest::testPositions ( )

Definition at line 125 of file PCFileListTest.php.

125 : void
126 {
127 $page = $this->getEmptyPageWithDom();
128 $pc = new ilPCFileList($page);
129 $pc->create($page, "pg");
130 $pc->appendItem("10", "file_loc", "image/jpeg");
131 $pc->appendItem("20", "file_loc2", "image/png");
132 $page->addHierIDs();
133 $pc->setHierId("1");
134 $pc->savePositions([
135 0 => "1_2:",
136 1 => "1_1:",
137 ]);
138 $page->stripHierIDs();
139 $expected = <<<EOT
140<PageObject><PageContent><FileList><FileItem><Identifier Catalog="ILIAS" Entry="il__file_20"></Identifier><Location Type="LocalFile">file_loc2</Location><Format>image/png</Format></FileItem><FileItem><Identifier Catalog="ILIAS" Entry="il__file_10"></Identifier><Location Type="LocalFile">file_loc</Location><Format>image/jpeg</Format></FileItem></FileList></PageContent></PageObject>
141EOT;
142 $this->assertXmlEquals(
143 $expected,
144 $page->getXMLFromDom()
145 );
146 }

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

+ Here is the call graph for this function:

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