From: Gunnar Wrobel
Date: Tue, 14 Dec 2010 09:51:36 +0000 (+0100)
Subject: Start adding a factory.
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=09801cd4e9fb951d00bebba191b33eb7b701428b;p=horde.git
Start adding a factory.
---
diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Factory.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Factory.php
new file mode 100644
index 000000000..8b71d0edd
--- /dev/null
+++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Factory.php
@@ -0,0 +1,40 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * A generic factory for the various Kolab_Storage classes.
+ *
+ * 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_Factory
+{
+ /**
+ * Create the storage handler.
+ *
+ * @return Horde_Kolab_Storage The storage handler.
+ */
+ public function create(Horde_Kolab_Storage_Driver $driver)
+ {
+ return new Horde_Kolab_Storage_Base($driver);
+ }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Storage/package.xml b/framework/Kolab_Storage/package.xml
index 8bb2b72c1..aa6a3e4b0 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
@@ -134,6 +134,7 @@
+
@@ -424,6 +425,7 @@
+
@@ -456,11 +458,6 @@
1.4.0b1
- Net_IMAP
- pear.php.net
- 1.1.0beta2
-
-
Mail_mimeDecode
pear.php.net
@@ -473,23 +470,10 @@
pear.horde.org
- Kolab_Server
- pear.horde.org
-
-
- Auth
- pear.horde.org
- 0.1.1
-
-
Cache
pear.horde.org
- Group
- pear.horde.org
-
-
History
pear.horde.org
@@ -507,10 +491,6 @@
pear.horde.org
- Nls
- pear.horde.org
-
-
Translation
pear.horde.org
@@ -519,6 +499,20 @@
pear.horde.org
+
+
+ Net_IMAP
+ pear.php.net
+ 1.1.0beta2
+
+
+ Imap_Client
+ pear.horde.org
+
+
+ imap
+
+
@@ -532,6 +526,7 @@
+
@@ -673,6 +668,7 @@
+
diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/FactoryTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/FactoryTest.php
new file mode 100644
index 000000000..03941b807
--- /dev/null
+++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/FactoryTest.php
@@ -0,0 +1,46 @@
+
+ * @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 factory.
+ *
+ * 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_FactoryTest
+extends Horde_Kolab_Storage_TestCase
+{
+ public function testConstruction()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $this->assertType(
+ 'Horde_Kolab_Storage_Base',
+ $factory->create(new Horde_Kolab_Storage_Driver_Mock())
+ );
+ }
+}