diff options
| author | Stephan Borg <wolff_borg@users.sourceforge.net> | 2005-09-10 23:58:30 +0000 |
|---|---|---|
| committer | Stephan Borg <wolff_borg@users.sourceforge.net> | 2005-09-10 23:58:30 +0000 |
| commit | 9788c8a01fee7676525b12526545f4e79ac3297c (patch) | |
| tree | 7ab05d9273564a49eaa625741943a817678166ba /test/TestBitPreferencesCacheDatabase.php | |
| parent | ca3b4278058e89ebaea49dc2ed4e8c5a3c726b76 (diff) | |
| download | kernel-9788c8a01fee7676525b12526545f4e79ac3297c.tar.gz kernel-9788c8a01fee7676525b12526545f4e79ac3297c.tar.bz2 kernel-9788c8a01fee7676525b12526545f4e79ac3297c.zip | |
Renamed files Tiki to Bit
Diffstat (limited to 'test/TestBitPreferencesCacheDatabase.php')
| -rw-r--r-- | test/TestBitPreferencesCacheDatabase.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/TestBitPreferencesCacheDatabase.php b/test/TestBitPreferencesCacheDatabase.php new file mode 100644 index 0000000..be7fe04 --- /dev/null +++ b/test/TestBitPreferencesCacheDatabase.php @@ -0,0 +1,69 @@ +<?php +require_once('bit_setup_inc.php'); +require_once(KERNEL_PKG_PATH.'BitPreferences.php'); + +class TestBitPreferencesCacheDatabase extends Test { + + var $name = "TestBitPreferencesCacheDatabase"; + + function TestBitPreferencesCacheDatabase() + { + global $gBitDb, $gBitCache; + $gBitCache = new BitCache(); + if (!is_object($gBitDb) || !is_object($gBitCache)) { + $this = NULL; + return; + } + $name = "`".$this->name."`"; + if (!$gBitDb->tableExists($name)) { + $tables = array( + $name => " + `name` C(50) PRIMARY, + `value` C(255) + "); + $gBitDb->createTables($tables); + } + $test = new BitPreferences($this->name); + Assert::equalsTrue($test != NULL, 'Error during initialisation'); + + } + + function testGetNonexistentItem() + { + $test = new BitPreferences($this->name); + Assert::equals($test->getPreference("test"), NULL); + } + + function testSetNonexistentItem() + { + $test = new BitPreferences($this->name); + $test->setPreference("test", "123"); + Assert::equals($test->getPreference("test"), "123"); + } + + function testSetDefaultItem() + { + $test = new BitPreferences($this->name); + //$test->mDebug = true; + $test->setDefaultPreference("test", "456"); + Assert::equals($test->getPreference("test"), "123"); + } + + function testSetAsDefaultItem() + { + $test = new BitPreferences($this->name); + //$test->mDebug = true; + $test->setDefaultPreference("test", "456"); + $test->setPreference("test", "456"); + Assert::equals($test->getPreference("test"), "456"); + } + + function testResetItem() + { + $test = new BitPreferences($this->name); + $test->setDefaultPreference("test", "456"); + $test->setPreference("test", NULL); + Assert::equals($test->getPreference("test"), "456"); + } +} +?> |
