1: <?php
2: /**
3: * Generates a Kolab storage handler.
4: *
5: * PHP version 5
6: *
7: * @category Horde
8: * @package Test
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL
11: * @link http://www.horde.org/components/Horde_Test
12: */
13:
14: /**
15: * Generates a Kolab storage handler.
16: *
17: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @since Horde_Test 1.2.0
23: *
24: * @category Horde
25: * @package Test
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL
28: * @link http://www.horde.org/components/Horde_Test
29: */
30: class Horde_Test_Factory_KolabStorage
31: {
32: /**
33: * Create a SQL next generate share setup.
34: *
35: * @params array $params Additional options.
36: * <pre>
37: * 'user' - (string) The current user.
38: * 'imapuser' - (string) The short IMAP ID of the user.
39: * </pre>
40: *
41: * @return Horde_Share_Sqlng The share setup.
42: */
43: public function create($params)
44: {
45: if (!class_exists('Horde_Kolab_Storage_Factory')) {
46: throw new Horde_Test_Exception('The "Horde_Kolab_Storage_Factory" class is unavailable!');
47: }
48: $kolab_factory = new Horde_Kolab_Storage_Factory(
49: array(
50: 'driver' => 'mock',
51: 'queryset' => array('list' => array('queryset' => 'horde')),
52: 'params' => array(
53: 'username' => $params['user'],
54: 'host' => 'localhost',
55: 'port' => 143,
56: 'data' => array(
57: 'user/' . $params['imapuser'] => array(
58: 'permissions' => array('anyone' => 'alrid')
59: )
60: )
61: )
62: )
63: );
64: return $kolab_factory->create();
65: }
66: }