ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
29{
30 protected $backupGlobals = FALSE;
31
32 protected function setUp()
33 {
34 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
35 ilUnitUtil::performInitialisation();
36 }
37
41 public function testSetGetSettings()
42 {
43 include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
44
45 $page = new ilXHTMLPage();
46 $page->setContent("aaa");
47 $page->save();
48 $page_id = $page->getId();
49
50 // save/read
51 $page = new ilXHTMLPage($page_id);
52 if ($page->getContent() == "aaa")
53 {
54 $result.= "saveread-";
55 }
56 $page->setContent("bbb");
57 $page->save();
58
59 // lookups
60 if (ilXHTMLPage::_lookupContent($page_id) == "bbb")
61 {
62 $result.= "lookupContent-";
63 }
64
65 if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa")
66 {
67 $result.= "lookupSavedContent-";
68 }
69
70 // undo
71 $page->undo();
72
73 if (ilXHTMLPage::_lookupContent($page_id) == "aaa")
74 {
75 $result.= "undo1-";
76 }
77
78 if (ilXHTMLPage::_lookupSavedContent($page_id) == "bbb")
79 {
80 $result.= "undo2-";
81 }
82
83 // clear
84 $page->clear();
85 if (ilXHTMLPage::_lookupContent($page_id) == "")
86 {
87 $result.= "clear1-";
88 }
89
90 if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa")
91 {
92 $result.= "clear2-";
93 }
94
95 $this->assertEquals("saveread-lookupContent-lookupSavedContent-undo1-undo2-clear1-clear2-", $result);
96 }
97
98}
99?>
$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.