ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilXHTMLPageTest.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24use PHPUnit\Framework\TestCase;
25
30class ilXHTMLPageTest extends TestCase
31{
32 protected $backupGlobals = false;
33
34 protected function setUp() : void
35 {
36 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
37 ilUnitUtil::performInitialisation();
38 }
39
43 public function testSetGetSettings()
44 {
45 include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
46
47 $page = new ilXHTMLPage();
48 $page->setContent("aaa");
49 $page->save();
50 $page_id = $page->getId();
51
52 // save/read
53 $page = new ilXHTMLPage($page_id);
54 if ($page->getContent() == "aaa") {
55 $result .= "saveread-";
56 }
57 $page->setContent("bbb");
58 $page->save();
59
60 // lookups
61 if (ilXHTMLPage::_lookupContent($page_id) == "bbb") {
62 $result .= "lookupContent-";
63 }
64
65 if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa") {
66 $result .= "lookupSavedContent-";
67 }
68
69 // undo
70 $page->undo();
71
72 if (ilXHTMLPage::_lookupContent($page_id) == "aaa") {
73 $result .= "undo1-";
74 }
75
76 if (ilXHTMLPage::_lookupSavedContent($page_id) == "bbb") {
77 $result .= "undo2-";
78 }
79
80 // clear
81 $page->clear();
82 if (ilXHTMLPage::_lookupContent($page_id) == "") {
83 $result .= "clear1-";
84 }
85
86 if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa") {
87 $result .= "clear2-";
88 }
89
90 $this->assertEquals("saveread-lookupContent-lookupSavedContent-undo1-undo2-clear1-clear2-", $result);
91 }
92}
$result
An exception for terminatinating execution or to throw for unit testing.
Class ilXHTMLPageTest @group needsInstalledILIAS.
testSetGetSettings()
@group IL_Init
XHTML Page class.
static _lookupContent($a_id)
Lookup Content.
static _lookupSavedContent($a_id)
Lookup Saved Content.