From 840799c09b0ea503b718e7bcbae25c272ab7afb0 Mon Sep 17 00:00:00 2001
From: Gunnar Wrobel
Date: Tue, 14 Dec 2010 09:51:19 +0100
Subject: [PATCH] Start extracting the core storage handler.
---
.../Kolab_Storage/lib/Horde/Kolab/Storage/Base.php | 60 ++++++++++++++++++++++
framework/Kolab_Storage/package.xml | 28 ++++++----
.../test/Horde/Kolab/Storage/Unit/BaseTest.php | 42 +++++++++++++++
3 files changed, 119 insertions(+), 11 deletions(-)
create mode 100644 framework/Kolab_Storage/lib/Horde/Kolab/Storage/Base.php
create mode 100644 framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/BaseTest.php
diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Base.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Base.php
new file mode 100644
index 000000000..e427b848b
--- /dev/null
+++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Base.php
@@ -0,0 +1,60 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * The basic handler for accessing data from Kolab storage.
+ *
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_Base
+{
+ /**
+ * The master Kolab storage system.
+ *
+ * @var Horde_Kolab_Storage_Driver
+ */
+ private $_master;
+
+ /**
+ * Constructor.
+ *
+ * @param Horde_Kolab_Storage_Driver $master The primary connection driver.
+ * @param string $driver The driver used for the primary storage connection.
+ * @param array $params Additional connection parameters.
+ */
+ public function __construct(Horde_Kolab_Storage_Driver $master)
+ {
+ $this->_master = $master;
+ }
+
+ /**
+ * Returns the list of folders visible to the current user.
+ *
+ * @return array The list of IMAP folders, represented as
+ * a list of strings.
+ */
+ public function listFolders()
+ {
+ return $this->_master->getMailboxes();
+ }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Storage/package.xml b/framework/Kolab_Storage/package.xml
index 6bc8a3dc8..8bb2b72c1 100644
--- a/framework/Kolab_Storage/package.xml
+++ b/framework/Kolab_Storage/package.xml
@@ -32,7 +32,7 @@
yes
2010-12-14
-
+
0.4.0
0.1.0
@@ -51,6 +51,9 @@
+
+
+
@@ -125,6 +128,7 @@
+
@@ -400,15 +404,6 @@
-
-
-
-
-
-
-
-
-
@@ -417,12 +412,17 @@
+
+
+
+
+
@@ -438,6 +438,7 @@
+
@@ -521,9 +522,11 @@
+
+
@@ -652,7 +655,6 @@
-
@@ -666,9 +668,13 @@
+
+
+
+
diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/BaseTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/BaseTest.php
new file mode 100644
index 000000000..409577b3c
--- /dev/null
+++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/BaseTest.php
@@ -0,0 +1,42 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test the basic storage handler.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_Unit_BaseTest
+extends Horde_Kolab_Storage_TestCase
+{
+ public function testConstruction()
+ {
+ new Horde_Kolab_Storage_Base(new Horde_Kolab_Storage_Driver_Mock());
+ }
+}
--
2.11.0