ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
25 {
26  protected $backupGlobals = FALSE;
27 
28  protected function setUp()
29  {
30  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
31  ilUnitUtil::performInitialisation();
32  }
33 
37  public function testSetGetSettings()
38  {
39  $set = new ilSetting("test_module");
40  $set->set("foo", "bar");
41  $value = $set->get("foo");
42 
43  $this->assertEquals("bar", $value);
44  }
45 
49  public function testDeletion()
50  {
51  // set two things for two modules
52  $set = new ilSetting("test_module");
53  $set->set("foo", "bar");
54  $set = new ilSetting("test_module2");
55  $set->set("foo2", "bar2");
56  $set = new ilSetting("test_module");
57  $set->deleteAll();
58 
59  $value = $set->get("foo", false, true)."-"; // should be "-" now
60 
61  $set = new ilSetting("test_module2");
62  $value.= $set->get("foo2"); // should be "-bar2" now
63 
64  $this->assertEquals("-bar2", $value);
65  }
66 
70  public function testLikeDeletion()
71  {
72  $set = new ilSetting("test_module3");
73  $set->set("foo", "plus");
74  $set->set("fooplus", "bar");
75  $set->set("barplus", "foo");
76  $set->deleteLike("foo%");
77 
78  $value = $set->get("foo")."-".
79  $set->get("fooplus")."-".
80  $set->get("barplus");
81 
82  $this->assertEquals("--foo", $value);
83  }
84 
85 }
86 ?>