ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PCFactoryTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\COPage\Test\PC;
22
23use PHPUnit\Framework\TestCase;
26
31{
32 public function testGetByNode(): void
33 {
34 global $DIC;
35
36 $dom_util = new \ILIAS\COPage\Dom\DomUtil();
37 $page = $this->getEmptyPageWithDom();
38 $page_content = new PageContentManager($page->getDomDoc());
39 $pc_factory = new PCFactory($def = $this->getPCDefinition());
40
41 $this->insertParagraphAt($page, "pg", "Hello");
42 $this->insertParagraphAt($page, "1", "World");
43 $page->insertPCIds();
44
45 $node = $page_content->getContentDomNode("1");
46 $pc = $pc_factory->getByNode($node, $page);
47
48 $this->assertEquals(
49 \ilPCParagraph::class,
50 get_class($pc)
51 );
52
53 $this->assertEquals(
54 "Hello",
55 $pc->getText()
56 );
57 }
58}
insertParagraphAt(\ilPageObject $page, string $hier_id, string $text="")
global $DIC
Definition: shib_login.php:26