ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest Class Reference
+ Inheritance diagram for PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest:
+ Collaboration diagram for PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest:

Public Member Functions

 testInsertPCIds ()
 
 testDuplicatePCIds ()
 
 testStripPCIds ()
 
 testGetHierIdsForPCIds ()
 
 testGetHierIdForPCId ()
 
 testGetPCIdsForHierIds ()
 
 testGetPCIdForHierId ()
 
 testCheckPCIds ()
 
 testGetAllPCIds ()
 

Protected Member Functions

 setUp ()
 
- 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

int $pc_cnt
 
- 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 30 of file ContentIdManagerTest.php.

Member Function Documentation

◆ setUp()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::setUp ( )
protected

Definition at line 33 of file ContentIdManagerTest.php.

33  : void
34  {
35  parent::setUp();
36  }

◆ testCheckPCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testCheckPCIds ( )

Definition at line 197 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

197  : void
198  {
199  $page = $this->getEmptyPageWithDom();
200  $id_manager = $this->getIDManager($page);
201 
202  $this->insertParagraphAt($page, "pg");
203  $this->insertParagraphAt($page, "1");
204  $this->insertParagraphAt($page, "2");
205 
206  $this->assertEquals(
207  false,
208  $id_manager->checkPCIds()
209  );
210 
211  $id_manager->insertPCIds();
212 
213  $this->assertEquals(
214  true,
215  $id_manager->checkPCIds()
216  );
217  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testDuplicatePCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testDuplicatePCIds ( )

Definition at line 66 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

66  : void
67  {
68  $page = $this->getEmptyPageWithDom();
69  $id_manager = $this->getIDManager($page);
70 
71  $this->insertParagraphAt($page, "pg");
72  $id_manager->insertPCIds();
73 
74  $this->insertParagraphAt($page, "1");
75  $id_manager->insertPCIds();
76 
77  $this->assertEquals(
78  false,
79  $id_manager->hasDuplicatePCIds()
80  );
81 
82  $this->insertParagraphAt($page, "2");
83  // force a duplicate
84  $this->pc_cnt--;
85  $id_manager->insertPCIds();
86 
87  $this->assertEquals(
88  [0 => "00000000000000000000000000000002"],
89  $id_manager->getDuplicatePCIds()
90  );
91 
92  $this->assertEquals(
93  true,
94  $id_manager->hasDuplicatePCIds()
95  );
96  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testGetAllPCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testGetAllPCIds ( )

Definition at line 219 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

219  : void
220  {
221  $page = $this->getEmptyPageWithDom();
222  $id_manager = $this->getIDManager($page);
223 
224  $this->insertParagraphAt($page, "pg");
225  $this->insertParagraphAt($page, "1");
226  $this->insertParagraphAt($page, "2");
227  $id_manager->insertPCIds();
228 
229  $this->assertEquals(
230  [
231  "00000000000000000000000000000001",
232  "00000000000000000000000000000002",
233  "00000000000000000000000000000003"
234  ],
235  $id_manager->getAllPCIds()
236  );
237  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testGetHierIdForPCId()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testGetHierIdForPCId ( )

Definition at line 142 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

142  : void
143  {
144  $page = $this->getEmptyPageWithDom();
145  $id_manager = $this->getIDManager($page);
146 
147  $this->insertParagraphAt($page, "pg");
148  $this->insertParagraphAt($page, "1");
149  $this->insertParagraphAt($page, "2");
150  $id_manager->insertPCIds();
151 
152  $this->assertEquals(
153  "2",
154  $id_manager->getHierIdForPCId("00000000000000000000000000000002")
155  );
156  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testGetHierIdsForPCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testGetHierIdsForPCIds ( )

Definition at line 119 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

119  : void
120  {
121  $page = $this->getEmptyPageWithDom();
122  $id_manager = $this->getIDManager($page);
123 
124  $this->insertParagraphAt($page, "pg");
125  $this->insertParagraphAt($page, "1");
126  $this->insertParagraphAt($page, "2");
127  $id_manager->insertPCIds();
128 
129  $hier_ids = $id_manager->getHierIdsForPCIds([
130  "00000000000000000000000000000001", "00000000000000000000000000000002"
131  ]);
132 
133  $this->assertEquals(
134  [
135  "00000000000000000000000000000001" => "1",
136  "00000000000000000000000000000002" => "2"
137  ],
138  $hier_ids
139  );
140  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testGetPCIdForHierId()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testGetPCIdForHierId ( )

Definition at line 181 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

181  : void
182  {
183  $page = $this->getEmptyPageWithDom();
184  $id_manager = $this->getIDManager($page);
185 
186  $this->insertParagraphAt($page, "pg");
187  $this->insertParagraphAt($page, "1");
188  $this->insertParagraphAt($page, "2");
189  $id_manager->insertPCIds();
190 
191  $this->assertEquals(
192  "00000000000000000000000000000002",
193  $id_manager->getPCIdForHierId("2")
194  );
195  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testGetPCIdsForHierIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testGetPCIdsForHierIds ( )

Definition at line 158 of file ContentIdManagerTest.php.

References COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and COPageTestBase\insertParagraphAt().

158  : void
159  {
160  $page = $this->getEmptyPageWithDom();
161  $id_manager = $this->getIDManager($page);
162 
163  $this->insertParagraphAt($page, "pg");
164  $this->insertParagraphAt($page, "1");
165  $this->insertParagraphAt($page, "2");
166  $id_manager->insertPCIds();
167 
168  $hier_ids = $id_manager->getPCIdsForHierIds([
169  "1", "2"
170  ]);
171 
172  $this->assertEquals(
173  [
174  "1" => "00000000000000000000000000000001",
175  "2" => "00000000000000000000000000000002"
176  ],
177  $hier_ids
178  );
179  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
+ Here is the call graph for this function:

◆ testInsertPCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testInsertPCIds ( )

Definition at line 38 of file ContentIdManagerTest.php.

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), COPageTestBase\getIDManager(), and ilPCGridGUI\TEMPLATE_TWO_COLUMN.

38  : void
39  {
40  $page = $this->getEmptyPageWithDom();
41  $pc = new \ilPCGrid($page);
42  $pc->create($page, "pg");
43  $pc->applyTemplate(
45  0,
46  0,
47  0,
48  0,
49  0
50  );
51 
52  $id_manager = $this->getIDManager($page);
53  $id_manager->insertPCIds();
54 
55  $expected = <<<EOT
56 <PageObject HierId="pg"><PageContent PCID="00000000000000000000000000000001"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="6" WIDTH_XL="6" PCID="00000000000000000000000000000002"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="6" WIDTH_XL="6" PCID="00000000000000000000000000000003"/></Grid></PageContent></PageObject>
57 EOT;
58 
59  $this->assertXmlEquals(
60  $expected,
61  $page->getXMLFromDom()
62  );
63  }
const TEMPLATE_TWO_COLUMN
getIDManager(\ilPageObject $page)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testStripPCIds()

PHPUnit\Framework\Attributes\Test\ID\ContentIdManagerTest::testStripPCIds ( )

Definition at line 98 of file ContentIdManagerTest.php.

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

98  : void
99  {
100  $page = $this->getEmptyPageWithDom();
101  $id_manager = $this->getIDManager($page);
102 
103  $this->insertParagraphAt($page, "pg");
104  $this->insertParagraphAt($page, "1");
105  $id_manager->insertPCIds();
106 
107  $id_manager->stripPCIDs();
108 
109  $expected = <<<EOT
110 <PageObject HierId="pg"><PageContent HierId="1"><Paragraph Language="en"/></PageContent><PageContent HierId="2"><Paragraph Language="en"/></PageContent></PageObject>
111 EOT;
112 
113  $this->assertXmlEquals(
114  $expected,
115  $page->getXMLFromDom()
116  );
117  }
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
getIDManager(\ilPageObject $page)
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

Field Documentation

◆ $pc_cnt

int PHPUnit::Framework::Attributes\Test::ID\ContentIdManagerTest::$pc_cnt
protected

Definition at line 32 of file ContentIdManagerTest.php.


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