ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PCBlogTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
20
25{
26 public function testConstruction(): void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc = new ilPCBlog($page);
30 $this->assertEquals(
31 ilPCBlog::class,
32 get_class($pc)
33 );
34 }
35
36 public function testCreate(): void
37 {
38 $page = $this->getEmptyPageWithDom();
39 $pc = new ilPCBlog($page);
40 $pc->create($page, "pg");
41 $this->assertXmlEquals(
42 '<PageObject HierId="pg"><PageContent><Blog></Blog></PageContent></PageObject>',
43 $page->getXMLFromDom()
44 );
45 }
46
47 public function testData(): void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc = new ilPCBlog($page);
51 $pc->create($page, "pg");
52 $pc->setData(10, [3,4,5]);
53
54 $this->assertEquals(
55 10,
56 $pc->getBlogId()
57 );
58
59 $this->assertEquals(
60 [3,4,5],
61 $pc->getPostings()
62 );
63
64 $expected = <<<EOT
65<PageObject HierId="pg"><PageContent><Blog Id="10" User="0"><BlogPosting Id="3"></BlogPosting><BlogPosting Id="4"></BlogPosting><BlogPosting Id="5"></BlogPosting></Blog></PageContent></PageObject>
66EOT;
67
68 $this->assertXmlEquals(
69 $expected,
70 $page->getXMLFromDom()
71 );
72 }
73}
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
testConstruction()
Definition: PCBlogTest.php:26
Class ilPCBlog Blog content object (see ILIAS DTD)