1: <?php
2: /**
3: * Ingo_Storage_Mock:: is used for testing purposes. It just keeps the
4: * data local and doesn't put it anywhere.
5: *
6: * See the enclosed file LICENSE for license information (ASL). If you
7: * did not receive this file, see http://www.horde.org/licenses/apache.
8: *
9: * @author Jason M. Felice <jason.m.felice@gmail.com>
10: * @package Ingo
11: */
12:
13: class Ingo_Storage_Mock extends Ingo_Storage
14: {
15: /**
16: */
17: protected $_data = array();
18:
19: /**
20: */
21: protected function _retrieve($field)
22: {
23: if (empty($this->_data[$field])) {
24: switch ($field) {
25: case self::ACTION_BLACKLIST:
26: return new Ingo_Storage_Blacklist();
27:
28: case self::ACTION_FILTERS:
29: $ob = new Ingo_Storage_Filters();
30: include INGO_BASE . '/config/prefs.php';
31: $ob->setFilterList(unserialize($_prefs['rules']['value']));
32: return $ob;
33:
34: case self::ACTION_FORWARD:
35: return new Ingo_Storage_Forward();
36:
37: case self::ACTION_VACATION:
38: return new Ingo_Storage_VacationTest();
39:
40: case self::ACTION_WHITELIST:
41: return new Ingo_Storage_Whitelist();
42:
43: case self::ACTION_SPAM:
44: return new Ingo_Storage_Spam();
45:
46: default:
47: return false;
48: }
49: }
50:
51: return $this->_data[$field];
52: }
53:
54: /**
55: */
56: protected function _store($ob)
57: {
58: $this->_data[$ob->obType()] = $ob;
59: }
60:
61: }
62: