ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 190 of file PCFileListTest.php.

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

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

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

◆ getPageWithFileList()

PCFileListTest::getPageWithFileList ( )
protected

Definition at line 177 of file PCFileListTest.php.

References COPageTestBase\getEmptyPageWithDom().

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

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

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

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>
55 EOT;
56 
57  $this->assertXmlEquals(
58  $expected,
59  $page->getXMLFromDom()
60  );
61  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testClasses()

PCFileListTest::testClasses ( )

Definition at line 149 of file PCFileListTest.php.

References COPageTestBase\getEmptyPageWithDom().

149  : void
150  {
151  $page = $this->getEmptyPageWithDom();
152  $pc = new ilPCFileList($page);
153  $pc->create($page, "pg");
154  $pc->appendItem("10", "file_loc", "image/jpeg");
155  $pc->appendItem("20", "file_loc2", "image/png");
156  $page->addHierIDs();
157  $pc->setHierId("1");
158  $pc->saveStyleClasses([
159  "1_1:" => "Class1",
160  "1_2:" => "Class2",
161  ]);
162  $classes = $pc->getAllClasses();
163 
164  $this->assertEquals(
165  [
166  "1_1:" => "Class1",
167  "1_2:" => "Class2",
168  ],
169  $pc->getAllClasses()
170  );
171  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testConstruction()

PCFileListTest::testConstruction ( )

Definition at line 26 of file PCFileListTest.php.

References COPageTestBase\getEmptyPageWithDom().

26  : void
27  {
28  $page = $this->getEmptyPageWithDom();
29  $pc = new ilPCFileList($page);
30  $this->assertEquals(
31  ilPCFileList::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...
+ Here is the call graph for this function:

◆ testCreate()

PCFileListTest::testCreate ( )

Definition at line 36 of file PCFileListTest.php.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testDeleteFileItem()

PCFileListTest::testDeleteFileItem ( )

Definition at line 109 of file PCFileListTest.php.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testDeleteItem()

PCFileListTest::testDeleteItem ( )

Definition at line 237 of file PCFileListTest.php.

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

237  : void
238  {
239  $page = $this->getPageWithFileList();
240  $item = $this->getItemForHierId($page, "1_2");
241  $item->deleteItem();
242  $page->stripHierIDs();
243  $page->stripPCIDs();
244 
245  $expected = <<<EOT
246 <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>
247 EOT;
248 
249  $this->assertXmlEquals(
250  $expected,
251  $page->getXMLFromDom()
252  );
253  }
getItemForHierId(ilPageObject $page, string $hier_id)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testFileList()

PCFileListTest::testFileList ( )

Definition at line 89 of file PCFileListTest.php.

References COPageTestBase\getEmptyPageWithDom().

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testListTitle()

PCFileListTest::testListTitle ( )

Definition at line 63 of file PCFileListTest.php.

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

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>
71 EOT;
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:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testMoveItemDown()

PCFileListTest::testMoveItemDown ( )

Definition at line 255 of file PCFileListTest.php.

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

255  : void
256  {
257  $page = $this->getPageWithFileList();
258  $item = $this->getItemForHierId($page, "1_1");
259  $item->moveItemDown();
260  $page->stripHierIDs();
261  $page->stripPCIDs();
262 
263  $expected = <<<EOT
264 <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>
265 EOT;
266 
267  $this->assertXmlEquals(
268  $expected,
269  $page->getXMLFromDom()
270  );
271  }
getItemForHierId(ilPageObject $page, string $hier_id)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testMoveItemUp()

PCFileListTest::testMoveItemUp ( )

Definition at line 273 of file PCFileListTest.php.

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

273  : void
274  {
275  $page = $this->getPageWithFileList();
276  $item = $this->getItemForHierId($page, "1_2");
277  $item->moveItemUp();
278  $page->stripHierIDs();
279  $page->stripPCIDs();
280 
281  $expected = <<<EOT
282 <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>
283 EOT;
284 
285  $this->assertXmlEquals(
286  $expected,
287  $page->getXMLFromDom()
288  );
289  }
getItemForHierId(ilPageObject $page, string $hier_id)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testNewItemAfter()

PCFileListTest::testNewItemAfter ( )

Definition at line 201 of file PCFileListTest.php.

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

201  : void
202  {
203  $page = $this->getPageWithFileList();
204  $item = $this->getItemForHierId($page, "1_1");
205  $item->newItemAfter("30", "file_loc3", "image/gif");
206  $page->stripHierIDs();
207  $page->stripPCIDs();
208 
209  $expected = <<<EOT
210 <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>
211 EOT;
212 
213  $this->assertXmlEquals(
214  $expected,
215  $page->getXMLFromDom()
216  );
217  }
getItemForHierId(ilPageObject $page, string $hier_id)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testNewItemBefore()

PCFileListTest::testNewItemBefore ( )

Definition at line 219 of file PCFileListTest.php.

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

219  : void
220  {
221  $page = $this->getPageWithFileList();
222  $item = $this->getItemForHierId($page, "1_2");
223  $item->newItemBefore("30", "file_loc3", "image/gif");
224  $page->stripHierIDs();
225  $page->stripPCIDs();
226 
227  $expected = <<<EOT
228 <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>
229 EOT;
230 
231  $this->assertXmlEquals(
232  $expected,
233  $page->getXMLFromDom()
234  );
235  }
getItemForHierId(ilPageObject $page, string $hier_id)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testPositions()

PCFileListTest::testPositions ( )

Definition at line 125 of file PCFileListTest.php.

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

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 
135  $pc->savePositions([
136  "1_1:" => 20,
137  "1_2:" => 10,
138  ]);
139  $page->stripHierIDs();
140  $expected = <<<EOT
141 <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>
142 EOT;
143  $this->assertXmlEquals(
144  $expected,
145  $page->getXMLFromDom()
146  );
147  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

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