ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
25 {
26  protected $backupGlobals = FALSE;
27 
28  protected function setUp()
29  {
30  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
32  }
33 
34  public function testSetGetSettings()
35  {
36  include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
37 
38  $page = new ilXHTMLPage();
39  $page->setContent("aaa");
40  $page->save();
41  $page_id = $page->getId();
42 
43  // save/read
44  $page = new ilXHTMLPage($page_id);
45  if ($page->getContent() == "aaa")
46  {
47  $result.= "saveread-";
48  }
49  $page->setContent("bbb");
50  $page->save();
51 
52  // lookups
53  if (ilXHTMLPage::_lookupContent($page_id) == "bbb")
54  {
55  $result.= "lookupContent-";
56  }
57 
58  if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa")
59  {
60  $result.= "lookupSavedContent-";
61  }
62 
63  // undo
64  $page->undo();
65 
66  if (ilXHTMLPage::_lookupContent($page_id) == "aaa")
67  {
68  $result.= "undo1-";
69  }
70 
71  if (ilXHTMLPage::_lookupSavedContent($page_id) == "bbb")
72  {
73  $result.= "undo2-";
74  }
75 
76  // clear
77  $page->clear();
78  if (ilXHTMLPage::_lookupContent($page_id) == "")
79  {
80  $result.= "clear1-";
81  }
82 
83  if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa")
84  {
85  $result.= "clear2-";
86  }
87 
88  $this->assertEquals("saveread-lookupContent-lookupSavedContent-undo1-undo2-clear1-clear2-", $result);
89  }
90 
91 }
92 ?>