ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PCParagraphTest Class Reference
+ Inheritance diagram for PCParagraphTest:
+ Collaboration diagram for PCParagraphTest:

Public Member Functions

 test_input2xmlEmpty ()
 Test _input2xml (empty) More...
 
 test_input2xmlValidXml ()
 Test _input2xml for validity. More...
 
 test_input2xmlResult ()
 Test _input2xml. More...
 
 testHandleAjaxContentPost ()
 Test handleAjaxContentPost. More...
 
 testHandleAjaxContentSpans ()
 Test HTML to BB transformation, spans. More...
 
 testHandleAjaxContentLists ()
 Test HTML to BB transformation, lists (are not transformed in this first step) More...
 
 testConstruction ()
 
 testCreate ()
 
 testLegacyHtml2Text ()
 
 testCharacteristic ()
 
 testSubCharacteristic ()
 
 testAutoIndent ()
 
 testDownloadTitle ()
 
 testShowLineNumbers ()
 
 testLanguage ()
 

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

Member Function Documentation

◆ test_input2xmlEmpty()

PCParagraphTest::test_input2xmlEmpty ( )

Test _input2xml (empty)

Definition at line 34 of file PCParagraphTest.php.

34 : void
35 {
36 $res = ilPCParagraph::_input2xml("", "en", true, false);
37 $this->assertEquals(
38 "",
39 $res
40 );
41 }
static _input2xml(string $a_text, string $a_lang, bool $a_wysiwyg=false, bool $a_handle_lists=true)
Converts user input to xml User input comes as bb code information, e.g.
$res
Definition: ltiservices.php:69

References $res, and ilPCParagraph\_input2xml().

+ Here is the call graph for this function:

◆ test_input2xmlResult()

PCParagraphTest::test_input2xmlResult ( )

Test _input2xml.

Definition at line 75 of file PCParagraphTest.php.

75 : void
76 {
77 $cases = [
78 ''
79 => '',
80 'xx'
81 => 'xx',
82
83 // text mark-up
84 'xx [str]xx[/str] xx'
85 => 'xx <Strong>xx</Strong> xx',
86 'xx [com]xx[/com] xx'
87 => 'xx <Comment>xx</Comment> xx',
88 'xx [emp]xx[/emp] xx'
89 => 'xx <Emph>xx</Emph> xx',
90 'xx [fn]xx[/fn] xx'
91 => 'xx <Footnote>xx</Footnote> xx',
92 'xx [code]xx[/code] xx'
93 => 'xx <Code>xx</Code> xx',
94 'xx [acc]xx[/acc] xx'
95 => 'xx <Accent>xx</Accent> xx',
96 'xx [imp]xx[/imp] xx'
97 => 'xx <Important>xx</Important> xx',
98 'xx [kw]xx[/kw] xx'
99 => 'xx <Keyw>xx</Keyw> xx',
100 'xx [sub]xx[/sub] xx'
101 => 'xx <Sub>xx</Sub> xx',
102 'xx [sup]xx[/sup] xx'
103 => 'xx <Sup>xx</Sup> xx',
104 'xx [quot]xx[/quot] xx'
105 => 'xx <Quotation>xx</Quotation> xx',
106
107 // internal links
108 'xx [iln cat="106"] xx [/iln] xx'
109 => 'xx <IntLink Target="il__obj_106" Type="RepositoryItem"> xx </IntLink> xx',
110 'xx [iln page="106"] xx [/iln] xx'
111 => 'xx <IntLink Target="il__pg_106" Type="PageObject"> xx </IntLink> xx',
112 'xx [iln page="106"] xx xx'
113 => 'xx xx xx',
114 'xx xx [/iln] xx'
115 => 'xx xx [/iln] xx',
116 'xx [iln chap="106"] xx [/iln] xx'
117 => 'xx <IntLink Target="il__st_106" Type="StructureObject"> xx </IntLink> xx',
118 'xx [iln inst="123" page="106"] xx [/iln] xx'
119 => 'xx <IntLink Target="il_123_pg_106" Type="PageObject"> xx </IntLink> xx',
120 'xx [iln page="106" target="FAQ"] xx [/iln] xx'
121 => 'xx <IntLink Target="il__pg_106" Type="PageObject" TargetFrame="FAQ"> xx </IntLink> xx',
122 'xx [iln page="106" target="New" anchor="test"] xx [/iln] xx'
123 => 'xx <IntLink Target="il__pg_106" Type="PageObject" TargetFrame="New" Anchor="test"> xx </IntLink> xx',
124 'xx [iln term="106"] xx [/iln] xx'
125 => 'xx <IntLink Target="il__git_106" Type="GlossaryItem" TargetFrame="Glossary"> xx </IntLink> xx',
126 'xx [iln term="106" target="New"] xx [/iln] xx'
127 => 'xx <IntLink Target="il__git_106" Type="GlossaryItem" TargetFrame="New"> xx </IntLink> xx',
128 'xx [iln wpage="106"] xx [/iln] xx'
129 => 'xx <IntLink Target="il__wpage_106" Type="WikiPage"> xx </IntLink> xx',
130 'xx [iln wpage="106" anchor="test"] xx [/iln] xx'
131 => 'xx <IntLink Target="il__wpage_106" Type="WikiPage" Anchor="test"> xx </IntLink> xx',
132 'xx [iln ppage="106"] xx [/iln] xx'
133 => 'xx <IntLink Target="il__ppage_106" Type="PortfolioPage"> xx </IntLink> xx',
134 'xx [iln media="545"/] xx '
135 => 'xx <IntLink Target="il__mob_545" Type="MediaObject"/> xx',
136 'xx [iln media="108" target="New"] xx [/iln] xx'
137 => 'xx <IntLink Target="il__mob_108" Type="MediaObject" TargetFrame="New"> xx </IntLink> xx',
138 'xx [iln media="108" target="Media"] xx [/iln] xx'
139 => 'xx <IntLink Target="il__mob_108" Type="MediaObject" TargetFrame="Media"> xx </IntLink> xx',
140 'xx [iln dfile="546"] xx [/iln] xx'
141 => 'xx <IntLink Target="il__dfile_546" Type="File"> xx </IntLink> xx',
142
143 // returns
144 'xx' . chr(13) . chr(10) . 'yy'
145 => 'xx<br />yy',
146 'xx' . chr(13) . 'yy'
147 => 'xx<br />yy',
148 'xx' . chr(10) . 'yy'
149 => 'xx<br />yy',
150
151 // lists
152 '<ul class="ilc_list_u_BulletedList"><li class="ilc_list_item_StandardListItem">aa</li><li class="ilc_list_item_StandardListItem">bb</li><li class="ilc_list_item_StandardListItem">cc</li></ul>'
153 => '&lt;ul class="ilc_list_u_BulletedList"&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;aa&lt;/li&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;bb&lt;/li&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;cc&lt;/li&gt;&lt;/ul&gt;',
154
155 // external links
156 'xx [xln url="http://"][/xln] xxxx'
157 => 'xx xxxx',
158 'xx [xln url="http://ilias.de"]www[/xln] xxxx'
159 => 'xx <ExtLink Href="http://ilias.de">www</ExtLink> xxxx',
160 'xx [xln url="http://ilias.php?x=1&y=2"]www[/xln] xxxx'
161 => 'xx <ExtLink Href="http://ilias.php?x=1&y=2">www</ExtLink> xxxx',
162 'xx [xln url="http://ilias.de/my+document.pdf"]doc[/xln] xxxx'
163 => 'xx <ExtLink Href="http://ilias.de/my+document.pdf">doc</ExtLink> xxxx',
164 'xx [xln url="http://ilias.de/my(document.pdf"]doc[/xln] xxxx'
165 => 'xx <ExtLink Href="http://ilias.de/my(document.pdf">doc</ExtLink> xxxx',
166 'xx [xln url="http://ilias.de/my)document.pdf"]doc[/xln] xxxx'
167 => 'xx <ExtLink Href="http://ilias.de/my)document.pdf">doc</ExtLink> xxxx',
168 'xx [xln url="http://ilias.de/my$document.pdf"]doc[/xln] xxxx'
169 => 'xx <ExtLink Href="http://ilias.de/my$document.pdf">doc</ExtLink> xxxx',
170 'xx [xln url="http://ilias.de/my*document.pdf"]doc[/xln] xxxx'
171 => 'xx <ExtLink Href="http://ilias.de/my*document.pdf">doc</ExtLink> xxxx',
172
173 // anchor
174 'xx [anc name="test"]test[/anc] xxxx'
175 => 'xx <Anchor Name="test">test</Anchor> xxxx',
176
177 // marked
178 'xx [marked class="test"]test[/marked] xxxx'
179 => 'xx <Marked Class="test">test</Marked> xxxx',
180
181 // non-break space
182 "xx \n \xa0 xxxx"
183 => "xx <br /> \xa0 xxxx",
184
185 'xx [xln url="http://ilias.de/my+document.pdf\xa0"]doc[/xln] xxxx'
186 => 'xx [error: xln url="http://ilias.de/my+document.pdf\xa0"]doc</ExtLink> xxxx',
187
188 /*'xx [iln cat="106"] xx'
189 => 'xx [iln cat="106"] xx',
190 'xx [/iln] xx'
191 => 'xx [/iln] xx'*/
192 ];
193
194 foreach ($cases as $in => $expected) {
195 $out = ilPCParagraph::_input2xml($in, "en", true, false);
196 $this->assertEquals(
197 $expected,
198 $out
199 );
200 }
201 }
$out
Definition: buildRTE.php:24

References $out, and ilPCParagraph\_input2xml().

+ Here is the call graph for this function:

◆ test_input2xmlValidXml()

PCParagraphTest::test_input2xmlValidXml ( )

Test _input2xml for validity.

Definition at line 46 of file PCParagraphTest.php.

46 : void
47 {
48 $cases = [
49 '',
50 'xx',
51 'xx [str]xx[/str] xx',
52 'xx [iln cat="106"] xx',
53 'xx [/iln] xx',
54 ];
55
56 foreach ($cases as $case) {
57 $text = ilPCParagraph::_input2xml($case, "en", true, false);
58 $use_internal_errors = libxml_use_internal_errors(true);
59 $sxe = simplexml_load_string("<?xml version='1.0'?><dummy>" . $text . "</dummy>");
60 libxml_use_internal_errors($use_internal_errors);
61 $res = true;
62 if ($sxe === false) {
63 $res = $text;
64 }
65 $this->assertEquals(
66 true,
67 $res
68 );
69 }
70 }

References $res, and ilPCParagraph\_input2xml().

+ Here is the call graph for this function:

◆ testAutoIndent()

PCParagraphTest::testAutoIndent ( )

Definition at line 491 of file PCParagraphTest.php.

491 : void
492 {
493 $page = $this->getEmptyPageWithDom();
494 $pc = new ilPCParagraph($page);
495 $pc->create($page, "pg");
496 $pc->setLanguage("en");
497 $pc->setAutoIndent("1");
498
499 $this->assertEquals(
500 "1",
501 $pc->getAutoIndent()
502 );
503 $page->stripHierIDs();
504
505 $expected = <<<EOT
506<PageObject><PageContent><Paragraph Language="en" AutoIndent="1"></Paragraph></PageContent></PageObject>
507EOT;
508 $this->assertXmlEquals(
509 $expected,
510 $page->getXMLFromDom()
511 );
512 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ testCharacteristic()

PCParagraphTest::testCharacteristic ( )

Definition at line 445 of file PCParagraphTest.php.

445 : void
446 {
447 $page = $this->getEmptyPageWithDom();
448 $pc = new ilPCParagraph($page);
449 $pc->create($page, "pg");
450 $pc->setLanguage("en");
451 $pc->setCharacteristic("MyChar");
452
453 $this->assertEquals(
454 "MyChar",
455 $pc->getCharacteristic()
456 );
457 $page->stripHierIDs();
458
459 $expected = <<<EOT
460<PageObject><PageContent><Paragraph Language="en" Characteristic="MyChar"></Paragraph></PageContent></PageObject>
461EOT;
462 $this->assertXmlEquals(
463 $expected,
464 $page->getXMLFromDom()
465 );
466 }

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

+ Here is the call graph for this function:

◆ testConstruction()

PCParagraphTest::testConstruction ( )

Definition at line 383 of file PCParagraphTest.php.

383 : void
384 {
385 $page = $this->getEmptyPageWithDom();
386 $pc = new ilPCParagraph($page);
387 $this->assertEquals(
388 ilPCParagraph::class,
389 get_class($pc)
390 );
391 }

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCParagraphTest::testCreate ( )

Definition at line 393 of file PCParagraphTest.php.

393 : void
394 {
395 $page = $this->getEmptyPageWithDom();
396 $pc = new ilPCParagraph($page);
397 $pc->create($page, "pg");
398 $this->assertXmlEquals(
399 '<PageObject HierId="pg"><PageContent><Paragraph Language=""></Paragraph></PageContent></PageObject>',
400 $page->getXMLFromDom()
401 );
402 }

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

+ Here is the call graph for this function:

◆ testDownloadTitle()

PCParagraphTest::testDownloadTitle ( )

Definition at line 514 of file PCParagraphTest.php.

514 : void
515 {
516 $page = $this->getEmptyPageWithDom();
517 $pc = new ilPCParagraph($page);
518 $pc->create($page, "pg");
519 $pc->setLanguage("en");
520 $pc->setDownloadTitle("title.txt");
521
522 $this->assertEquals(
523 "title.txt",
524 $pc->getDownloadTitle()
525 );
526 $page->stripHierIDs();
527
528 $expected = <<<EOT
529<PageObject><PageContent><Paragraph Language="en" DownloadTitle="title.txt"></Paragraph></PageContent></PageObject>
530EOT;
531 $this->assertXmlEquals(
532 $expected,
533 $page->getXMLFromDom()
534 );
535 }

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

+ Here is the call graph for this function:

◆ testHandleAjaxContentLists()

PCParagraphTest::testHandleAjaxContentLists ( )

Test HTML to BB transformation, lists (are not transformed in this first step)

Definition at line 343 of file PCParagraphTest.php.

343 : void
344 {
345 $cases = [
346 // List, Bullet
347 '<div id="1:1234" class="ilc_text_block_List"><ul class="ilc_list_u_BulletedList"><li class="ilc_list_item_StandardListItem">one</li><li class="ilc_list_item_StandardListItem">two</li><li class="ilc_list_item_StandardListItem">three</li></ul></div>'
348 => [
349 "text" => '<ul class="ilc_list_u_BulletedList"><li class="ilc_list_item_StandardListItem">one</li><li class="ilc_list_item_StandardListItem">two</li><li class="ilc_list_item_StandardListItem">three</li></ul>',
350 "id" => '1:1234',
351 "class" => 'List'
352 ],
353 // List, Numberd
354 '<div id="1:1235" class="ilc_text_block_List"><ol class="ilc_list_o_NumberedList"><li class="ilc_list_item_StandardListItem">one</li><li class="ilc_list_item_StandardListItem">two</li><li class="ilc_list_item_StandardListItem">three</li></ol></div>'
355 => [
356 "text" => '<ol class="ilc_list_o_NumberedList"><li class="ilc_list_item_StandardListItem">one</li><li class="ilc_list_item_StandardListItem">two</li><li class="ilc_list_item_StandardListItem">three</li></ol>',
357 "id" => '1:1235',
358 "class" => 'List'
359 ],
360 ];
361
362 foreach ($cases as $in => $expected) {
364 $this->assertEquals(
365 $expected["text"],
366 $out["text"]
367 );
368 $this->assertEquals(
369 $expected["id"],
370 $out["id"]
371 );
372 $this->assertEquals(
373 $expected["class"],
374 $out["class"]
375 );
376 }
377 }
static handleAjaxContent(string $a_content)
Handle ajax content.

References $out, and ilPCParagraph\handleAjaxContent().

+ Here is the call graph for this function:

◆ testHandleAjaxContentPost()

PCParagraphTest::testHandleAjaxContentPost ( )

Test handleAjaxContentPost.

Definition at line 206 of file PCParagraphTest.php.

206 : void
207 {
208 $cases = [
209 '&lt;ul class="ilc_list_u_BulletedList"&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;aa&lt;/li&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;bb&lt;/li&gt;&lt;li class="ilc_list_item_StandardListItem"&gt;cc&lt;/li&gt;&lt;/ul&gt;'
210 => '<SimpleBulletList Class="BulletedList"><SimpleListItem Class="StandardListItem">aa</SimpleListItem><SimpleListItem Class="StandardListItem">bb</SimpleListItem><SimpleListItem Class="StandardListItem">cc</SimpleListItem></SimpleBulletList>',
211 '&lt;ul class="ilc_list_u_BulletedList"&gt;&lt;li class="ilc_list_item_StandardListItem"/&gt;&lt;/ul&gt;'
212 => '<SimpleBulletList Class="BulletedList"><SimpleListItem Class="StandardListItem"></SimpleListItem></SimpleBulletList>'
213 ];
214
215 foreach ($cases as $in => $expected) {
217 $this->assertEquals(
218 $expected,
219 $out
220 );
221 }
222 }
static handleAjaxContentPost(string $text)
Post input2xml handling of ajax content.

References $out, and ilPCParagraph\handleAjaxContentPost().

+ Here is the call graph for this function:

◆ testHandleAjaxContentSpans()

PCParagraphTest::testHandleAjaxContentSpans ( )

Test HTML to BB transformation, spans.

Definition at line 227 of file PCParagraphTest.php.

227 : void
228 {
229 $cases = [
230 // Standard, Strong
231 '<div id="1:1234" class="ilc_text_block_Standard">xxx<span class="ilc_text_inline_Strong">xxx</span>xxx</div>'
232 => [
233 "text" => 'xxx[str]xxx[/str]xxx',
234 "id" => '1:1234',
235 "class" => 'Standard'
236 ],
237 // Mnemonic, Emphatic
238 '<div id="1:1235" class="ilc_text_block_Mnemonic">xxx<span class="ilc_text_inline_Emph">xxx</span>xxx</div>'
239 => [
240 "text" => 'xxx[emp]xxx[/emp]xxx',
241 "id" => '1:1235',
242 "class" => 'Mnemonic'
243 ],
244 // Headline1, Important
245 '<div id="1:1236" class="ilc_text_block_Headline1">xxx<span class="ilc_text_inline_Important">xxx</span>xxx</div>'
246 => [
247 "text" => 'xxx[imp]xxx[/imp]xxx',
248 "id" => '1:1236',
249 "class" => 'Headline1'
250 ],
251 // Standard, Sup
252 '<div id="1:1237" class="ilc_text_block_Standard">xxx a<sup class="ilc_sup_Sup">b*c</sup> xxx</div>'
253 => [
254 "text" => 'xxx a[sup]b*c[/sup] xxx',
255 "id" => '1:1237',
256 "class" => 'Standard'
257 ],
258 // Standard, Sub
259 '<div id="1:1238" class="ilc_text_block_Standard">xxx a<sub class="ilc_sub_Sub">2</sub> xxx</div>'
260 => [
261 "text" => 'xxx a[sub]2[/sub] xxx',
262 "id" => '1:1238',
263 "class" => 'Standard'
264 ],
265 // Standard, Sup (without class, e.g. coming from word)
266 '<div id="1:1237" class="ilc_text_block_Standard">xxx a<sup>b*c</sup> xxx</div>'
267 => [
268 "text" => 'xxx a[sup]b*c[/sup] xxx',
269 "id" => '1:1237',
270 "class" => 'Standard'
271 ],
272 // Standard, Sub (without class, e.g. coming from word)
273 '<div id="1:1238" class="ilc_text_block_Standard">xxx a<sub>2</sub> xxx</div>'
274 => [
275 "text" => 'xxx a[sub]2[/sub] xxx',
276 "id" => '1:1238',
277 "class" => 'Standard'
278 ],
279 // Headline2, Comment
280 '<div id="1:1239" class="ilc_text_block_Headline2">xxx <span class="ilc_text_inline_Comment">xxx</span> xxx</div>'
281 => [
282 "text" => 'xxx [com]xxx[/com] xxx',
283 "id" => '1:1239',
284 "class" => 'Headline2'
285 ],
286 // Headline3, Comment
287 '<div id="1:1240" class="ilc_text_block_Headline3">xxx <span class="ilc_text_inline_Quotation">xxx</span> xxx</div>'
288 => [
289 "text" => 'xxx [quot]xxx[/quot] xxx',
290 "id" => '1:1240',
291 "class" => 'Headline3'
292 ],
293 // Book, Accent
294 '<div id="1:1241" class="ilc_text_block_Book">xxx <span class="ilc_text_inline_Accent">xxx</span> xxx</div>'
295 => [
296 "text" => 'xxx [acc]xxx[/acc] xxx',
297 "id" => '1:1241',
298 "class" => 'Book'
299 ],
300 // Numbers, Code
301 '<div id="1:1242" class="ilc_text_block_Numbers">xxx <code>xxx</code> xxx</div>'
302 => [
303 "text" => 'xxx [code]xxx[/code] xxx',
304 "id" => '1:1242',
305 "class" => 'Numbers'
306 ],
307 // Verse, Mnemonic
308 '<div id="1:1243" class="ilc_text_block_Verse">xxx <span class="ilc_text_inline_Mnemonic">xxx</span> xxx</div>'
309 => [
310 "text" => 'xxx [marked class="Mnemonic"]xxx[/marked] xxx',
311 "id" => '1:1243',
312 "class" => 'Verse'
313 ],
314 // List, Attention
315 '<div id="1:1244" class="ilc_text_block_List">xxx <span class="ilc_text_inline_Attention">xxx</span> xxx</div>'
316 => [
317 "text" => 'xxx [marked class="Attention"]xxx[/marked] xxx',
318 "id" => '1:1244',
319 "class" => 'List'
320 ],
321 ];
322
323 foreach ($cases as $in => $expected) {
325 $this->assertEquals(
326 $expected["text"],
327 $out["text"]
328 );
329 $this->assertEquals(
330 $expected["id"],
331 $out["id"]
332 );
333 $this->assertEquals(
334 $expected["class"],
335 $out["class"]
336 );
337 }
338 }

References $out, and ilPCParagraph\handleAjaxContent().

+ Here is the call graph for this function:

◆ testLanguage()

PCParagraphTest::testLanguage ( )

Definition at line 560 of file PCParagraphTest.php.

560 : void
561 {
562 $page = $this->getEmptyPageWithDom();
563 $pc = new ilPCParagraph($page);
564 $pc->create($page, "pg");
565 $pc->setLanguage("en");
566
567 $this->assertEquals(
568 "en",
569 $pc->getLanguage()
570 );
571 $page->stripHierIDs();
572
573 $expected = <<<EOT
574<PageObject><PageContent><Paragraph Language="en"></Paragraph></PageContent></PageObject>
575EOT;
576 $this->assertXmlEquals(
577 $expected,
578 $page->getXMLFromDom()
579 );
580 }

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

+ Here is the call graph for this function:

◆ testLegacyHtml2Text()

PCParagraphTest::testLegacyHtml2Text ( )

Definition at line 409 of file PCParagraphTest.php.

409 : void
410 {
411 $page = $this->getEmptyPageWithDom();
412 $pc = new ilPCParagraph($page);
413 $pc->create($page, "pg");
414
415 $cases = [
416 ''
417 => '',
418 'Some text'
419 => 'Some text',
420 'test &amp; the &lt; and the &gt; and the \ also'
421 => 'test &amp;amp; the &amp;lt; and the &amp;gt; and the \ also',
422 'xxx <span class="ilc_text_inline_Strong">xxx</span> xxx'
423 => 'xxx <Strong>xxx</Strong> xxx',
424 ];
425
426 foreach ($cases as $html => $expected) {
427 $html = '<div id="1:1234" class="ilc_text_block_Standard">' . $html . '</div>';
428 $xml = $this->legacyHtmlToXml($html);
429 $pc->setText($xml, false);
430
431 $expected = '<PageObject HierId="pg"><PageContent><Paragraph Language="">' . $expected . '</Paragraph></PageContent></PageObject>';
432
433 $this->assertEquals(
434 $xml,
435 $pc->getText()
436 );
437
438 $this->assertXmlEquals(
439 $expected,
440 $page->getXMLFromDom()
441 );
442 }
443 }
legacyHtmlToXml(string $content)

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

+ Here is the call graph for this function:

◆ testShowLineNumbers()

PCParagraphTest::testShowLineNumbers ( )

Definition at line 537 of file PCParagraphTest.php.

537 : void
538 {
539 $page = $this->getEmptyPageWithDom();
540 $pc = new ilPCParagraph($page);
541 $pc->create($page, "pg");
542 $pc->setLanguage("en");
543 $pc->setShowLineNumbers("y");
544
545 $this->assertEquals(
546 "y",
547 $pc->getShowLineNumbers()
548 );
549 $page->stripHierIDs();
550
551 $expected = <<<EOT
552<PageObject><PageContent><Paragraph Language="en" ShowLineNumbers="y"></Paragraph></PageContent></PageObject>
553EOT;
554 $this->assertXmlEquals(
555 $expected,
556 $page->getXMLFromDom()
557 );
558 }

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

+ Here is the call graph for this function:

◆ testSubCharacteristic()

PCParagraphTest::testSubCharacteristic ( )

Definition at line 468 of file PCParagraphTest.php.

468 : void
469 {
470 $page = $this->getEmptyPageWithDom();
471 $pc = new ilPCParagraph($page);
472 $pc->create($page, "pg");
473 $pc->setLanguage("en");
474 $pc->setSubCharacteristic("MySubChar");
475
476 $this->assertEquals(
477 "MySubChar",
478 $pc->getSubCharacteristic()
479 );
480 $page->stripHierIDs();
481
482 $expected = <<<EOT
483<PageObject><PageContent><Paragraph Language="en" SubCharacteristic="MySubChar"></Paragraph></PageContent></PageObject>
484EOT;
485 $this->assertXmlEquals(
486 $expected,
487 $page->getXMLFromDom()
488 );
489 }

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: