ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSettingTest.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  $set = new ilSetting("test_module");
44  $set->set("foo", "bar");
45  $value = $set->get("foo");
46 
47  $this->assertEquals("bar", $value);
48  }
49 
53  public function testDeletion()
54  {
55  // set two things for two modules
56  $set = new ilSetting("test_module");
57  $set->set("foo", "bar");
58  $set = new ilSetting("test_module2");
59  $set->set("foo2", "bar2");
60  $set = new ilSetting("test_module");
61  $set->deleteAll();
62 
63  $value = $set->get("foo", false, true)."-"; // should be "-" now
64 
65  $set = new ilSetting("test_module2");
66  $value.= $set->get("foo2"); // should be "-bar2" now
67 
68  $this->assertEquals("-bar2", $value);
69  }
70 
74  public function testLikeDeletion()
75  {
76  $set = new ilSetting("test_module3");
77  $set->set("foo", "plus");
78  $set->set("fooplus", "bar");
79  $set->set("barplus", "foo");
80  $set->deleteLike("foo%");
81 
82  $value = $set->get("foo")."-".
83  $set->get("fooplus")."-".
84  $set->get("barplus");
85 
86  $this->assertEquals("--foo", $value);
87  }
88 
89 }
90 ?>
ILIAS Setting Class.
Class ilSettingTest needsInstalledILIAS.
testLikeDeletion()
IL_Init
testDeletion()
IL_Init
testSetGetSettings()
IL_Init