ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
PCSectionTest Class Reference
+ Inheritance diagram for PCSectionTest:
+ Collaboration diagram for PCSectionTest:

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testCharacteristic ()
 
 testProtected ()
 
 testActiveFrom ()
 
 testActiveTo ()
 
 testPermission ()
 
 testPermissionRefId ()
 
 testPermissionRefIdIsAdaptedOnRepositoryCopy ()
 
 testExtLink ()
 
 testIntLink ()
 
 testNoLink ()
 
 testModel ()
 

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

Member Function Documentation

◆ testActiveFrom()

PCSectionTest::testActiveFrom ( )

Definition at line 91 of file PCSectionTest.php.

91 : void
92 {
93 $page = $this->getEmptyPageWithDom();
94 $pc_sec = new ilPCSection($page);
95 $pc_sec->create($page, "pg");
96 $pc_sec->setActiveFrom(1234);
97
98 $this->assertEquals(
99 1234,
100 $pc_sec->getActiveFrom()
101 );
102
103 $expected = <<<EOT
104<PageObject HierId="pg"><PageContent><Section Characteristic="Block" ActiveFrom="1234"></Section></PageContent></PageObject>
105EOT;
106
107 $this->assertXmlEquals(
108 $expected,
109 $page->getXMLFromDom()
110 );
111 }
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 $page, COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testActiveTo()

PCSectionTest::testActiveTo ( )

Definition at line 113 of file PCSectionTest.php.

113 : void
114 {
115 $page = $this->getEmptyPageWithDom();
116 $pc_sec = new ilPCSection($page);
117 $pc_sec->create($page, "pg");
118 $pc_sec->setActiveTo(5678);
119
120 $this->assertEquals(
121 5678,
122 $pc_sec->getActiveTo()
123 );
124
125 $expected = <<<EOT
126<PageObject HierId="pg"><PageContent><Section Characteristic="Block" ActiveTo="5678"></Section></PageContent></PageObject>
127EOT;
128
129 $this->assertXmlEquals(
130 $expected,
131 $page->getXMLFromDom()
132 );
133 }

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

+ Here is the call graph for this function:

◆ testCharacteristic()

PCSectionTest::testCharacteristic ( )

Definition at line 47 of file PCSectionTest.php.

47 : void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc_sec = new ilPCSection($page);
51 $pc_sec->create($page, "pg");
52 $pc_sec->setCharacteristic("MyChar");
53
54 $this->assertEquals(
55 "MyChar",
56 $pc_sec->getCharacteristic()
57 );
58
59 $expected = <<<EOT
60<PageObject HierId="pg"><PageContent><Section Characteristic="MyChar"></Section></PageContent></PageObject>
61EOT;
62
63 $this->assertXmlEquals(
64 $expected,
65 $page->getXMLFromDom()
66 );
67 }

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

+ Here is the call graph for this function:

◆ testConstruction()

PCSectionTest::testConstruction ( )

Definition at line 26 of file PCSectionTest.php.

26 : void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc_sec = new ilPCSection($page);
30 $this->assertEquals(
31 ilPCSection::class,
32 get_class($pc_sec)
33 );
34 }

References $page, and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCSectionTest::testCreate ( )

Definition at line 36 of file PCSectionTest.php.

36 : void
37 {
38 $page = $this->getEmptyPageWithDom();
39 $pc_sec = new ilPCSection($page);
40 $pc_sec->create($page, "pg");
41 $this->assertXmlEquals(
42 '<PageObject HierId="pg"><PageContent><Section Characteristic="Block"></Section></PageContent></PageObject>',
43 $page->getXMLFromDom()
44 );
45 }

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

+ Here is the call graph for this function:

◆ testExtLink()

PCSectionTest::testExtLink ( )

Definition at line 195 of file PCSectionTest.php.

195 : void
196 {
197 $page = $this->getEmptyPageWithDom();
198 $pc_sec = new ilPCSection($page);
199 $pc_sec->create($page, "pg");
200 $pc_sec->setExtLink("https://www.ilias.de");
201
202 $ext_link = $pc_sec->getLink();
203
204 $this->assertEquals(
205 "ExtLink",
206 $ext_link["LinkType"]
207 );
208
209 $this->assertEquals(
210 "https://www.ilias.de",
211 $ext_link["Href"]
212 );
213
214 $expected = <<<EOT
215<PageObject HierId="pg"><PageContent><Section Characteristic="Block"><ExtLink Href="https://www.ilias.de"></ExtLink></Section></PageContent></PageObject>
216EOT;
217
218 $this->assertXmlEquals(
219 $expected,
220 $page->getXMLFromDom()
221 );
222 }

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

+ Here is the call graph for this function:

◆ testIntLink()

PCSectionTest::testIntLink ( )

Definition at line 224 of file PCSectionTest.php.

224 : void
225 {
226 $page = $this->getEmptyPageWithDom();
227 $pc_sec = new ilPCSection($page);
228 $pc_sec->create($page, "pg");
229 $pc_sec->setIntLink("mytype", "mytarget", "myframe");
230
231 $link = $pc_sec->getLink();
232
233 $this->assertEquals(
234 "IntLink",
235 $link["LinkType"]
236 );
237
238 $this->assertEquals(
239 "mytype",
240 $link["Type"]
241 );
242
243 $this->assertEquals(
244 "mytarget",
245 $link["Target"]
246 );
247
248 $this->assertEquals(
249 "myframe",
250 $link["TargetFrame"]
251 );
252
253 $expected = <<<EOT
254<PageObject HierId="pg"><PageContent><Section Characteristic="Block"><IntLink Type="mytype" Target="mytarget" TargetFrame="myframe"></IntLink></Section></PageContent></PageObject>
255EOT;
256
257 $this->assertXmlEquals(
258 $expected,
259 $page->getXMLFromDom()
260 );
261 }

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

+ Here is the call graph for this function:

◆ testModel()

PCSectionTest::testModel ( )

Definition at line 296 of file PCSectionTest.php.

296 : void
297 {
298 $page = $this->getEmptyPageWithDom();
299 $pc_sec = new ilPCSection($page);
300 $pc_sec->create($page, "pg");
301
302 $pc_sec->setProtected(true);
303
304 $model = new stdClass();
305 $model->protected = true;
306
307
308 $this->assertEquals(
309 $model,
310 $pc_sec->getModel()
311 );
312 }

References $page, and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testNoLink()

PCSectionTest::testNoLink ( )

Definition at line 263 of file PCSectionTest.php.

263 : void
264 {
265 $page = $this->getEmptyPageWithDom();
266 $pc_sec = new ilPCSection($page);
267 $pc_sec->create($page, "pg");
268
269 $link = $pc_sec->getLink();
270
271 $this->assertEquals(
272 "NoLink",
273 $link["LinkType"]
274 );
275
276 $pc_sec->setIntLink("mytype", "mytarget", "myframe");
277 $pc_sec->setNoLink();
278
279 $link = $pc_sec->getLink();
280
281 $this->assertEquals(
282 "NoLink",
283 $link["LinkType"]
284 );
285
286 $expected = <<<EOT
287<PageObject HierId="pg"><PageContent><Section Characteristic="Block"></Section></PageContent></PageObject>
288EOT;
289
290 $this->assertXmlEquals(
291 $expected,
292 $page->getXMLFromDom()
293 );
294 }

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

+ Here is the call graph for this function:

◆ testPermission()

PCSectionTest::testPermission ( )

Definition at line 135 of file PCSectionTest.php.

135 : void
136 {
137 $page = $this->getEmptyPageWithDom();
138 $pc_sec = new ilPCSection($page);
139 $pc_sec->create($page, "pg");
140 $pc_sec->setPermission("write");
141
142 $this->assertEquals(
143 "write",
144 $pc_sec->getPermission()
145 );
146
147 $expected = <<<EOT
148<PageObject HierId="pg"><PageContent><Section Characteristic="Block" Permission="write"></Section></PageContent></PageObject>
149EOT;
150
151 $this->assertXmlEquals(
152 $expected,
153 $page->getXMLFromDom()
154 );
155 }

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

+ Here is the call graph for this function:

◆ testPermissionRefId()

PCSectionTest::testPermissionRefId ( )

Definition at line 157 of file PCSectionTest.php.

157 : void
158 {
159 $page = $this->getEmptyPageWithDom();
160 $pc_sec = new ilPCSection($page);
161 $pc_sec->create($page, "pg");
162 $pc_sec->setPermissionRefId(10);
163
164 $this->assertEquals(
165 10,
166 $pc_sec->getPermissionRefId()
167 );
168
169 $expected = <<<EOT
170<PageObject HierId="pg"><PageContent><Section Characteristic="Block" PermissionRefId="il__ref_10"></Section></PageContent></PageObject>
171EOT;
172
173 $this->assertXmlEquals(
174 $expected,
175 $page->getXMLFromDom()
176 );
177 }

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

+ Here is the call graph for this function:

◆ testPermissionRefIdIsAdaptedOnRepositoryCopy()

PCSectionTest::testPermissionRefIdIsAdaptedOnRepositoryCopy ( )

Definition at line 179 of file PCSectionTest.php.

179 : void
180 {
181 $page = $this->getEmptyPageWithDom();
182 $pc_sec = new ilPCSection($page);
183 $pc_sec->create($page, "pg");
184 $pc_sec->setPermissionRefId(10);
185
187
188 $this->assertSame(20, $pc_sec->getPermissionRefId());
189
191
192 $this->assertSame(20, $pc_sec->getPermissionRefId());
193 }
static afterRepositoryCopy(ilPageObject $page, array $mapping, int $source_ref_id)
After repository (container) copy action.

References $page, ilPageContent\afterRepositoryCopy(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testProtected()

PCSectionTest::testProtected ( )

Definition at line 69 of file PCSectionTest.php.

69 : void
70 {
71 $page = $this->getEmptyPageWithDom();
72 $pc_sec = new ilPCSection($page);
73 $pc_sec->create($page, "pg");
74 $pc_sec->setProtected(true);
75
76 $this->assertEquals(
77 true,
78 $pc_sec->getProtected()
79 );
80
81 $expected = <<<EOT
82<PageObject HierId="pg"><PageContent><Section Characteristic="Block" Protected="1"></Section></PageContent></PageObject>
83EOT;
84
85 $this->assertXmlEquals(
86 $expected,
87 $page->getXMLFromDom()
88 );
89 }

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

+ Here is the call graph for this function:

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