ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PageLayoutTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
24
29{
30 public function testConstruction(): void
31 {
32 $layout = new \ilPageLayout(0);
33 $this->assertEquals(
34 \ilPageLayout::class,
35 get_class($layout)
36 );
37 }
38
39 public function testPreviewEmpty(): void
40 {
41 $layout = new \ilPageLayout(0);
42
43 $page = $this->getEmptyPageWithDom();
44
45 $layout->setXMLContent($page->getXMLFromDom());
46
47 $this->assertStringContainsString(
48 '<table class="il-style-layout-preview-wrapper">',
49 $layout->getPreview()
50 );
51 }
52
53 public function testPreviewPlaceholderText(): void
54 {
55 $layout = new \ilPageLayout(0);
56
57 $page = $this->getEmptyPageWithDom();
58 $pc = new \ilPCPlaceHolder($page);
59 $pc->create($page, "pg");
60 $pc->setContentClass("Text");
61 $pc->setHeight("300");
62
63 $layout->setXMLContent($page->getXMLFromDom());
64
65 $this->assertStringContainsString(
66 'class="ilc_TextPlaceHolderThumb"',
67 $layout->getPreview()
68 );
69 }
70
71 public function testPreviewPlaceholderMedia(): void
72 {
73 $layout = new \ilPageLayout(0);
74
75 $page = $this->getEmptyPageWithDom();
76 $pc = new \ilPCPlaceHolder($page);
77 $pc->create($page, "pg");
78 $pc->setContentClass("Media");
79 $pc->setHeight("300");
80
81 $layout->setXMLContent($page->getXMLFromDom());
82
83 $this->assertStringContainsString(
84 'class="ilc_MediaPlaceHolderThumb"',
85 $layout->getPreview()
86 );
87 }
88
89 public function testPreviewPlaceholderQuestion(): void
90 {
91 $layout = new \ilPageLayout(0);
92
93 $page = $this->getEmptyPageWithDom();
94 $pc = new \ilPCPlaceHolder($page);
95 $pc->create($page, "pg");
96 $pc->setContentClass("Question");
97 $pc->setHeight("300");
98
99 $layout->setXMLContent($page->getXMLFromDom());
100
101 $this->assertStringContainsString(
102 'class="ilc_QuestionPlaceHolderThumb"',
103 $layout->getPreview()
104 );
105 }
106}