From 4efcde6ab08acb09c16a27ce084f82723d1ccf51 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Thu, 6 Jan 2011 15:27:46 +0100 Subject: [PATCH] Add the getNamespace() method to the list handler. --- .../Kolab_Storage/lib/Horde/Kolab/Storage/List.php | 7 +++++++ .../lib/Horde/Kolab/Storage/List/Base.php | 10 ++++++++++ .../lib/Horde/Kolab/Storage/List/Decorator/Cache.php | 10 ++++++++++ .../lib/Horde/Kolab/Storage/List/Decorator/Log.php | 10 ++++++++++ .../lib/Horde/Kolab/Storage/List/Query.php | 20 ++++++++++++++++++++ .../test/Horde/Kolab/Storage/Unit/List/BaseTest.php | 10 ++++++++++ .../Kolab/Storage/Unit/List/Decorator/CacheTest.php | 12 ++++++++++++ .../Kolab/Storage/Unit/List/Decorator/LogTest.php | 12 ++++++++++++ 8 files changed, 91 insertions(+) diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List.php index b444dd5f8..6d2ed1af8 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List.php @@ -51,6 +51,13 @@ extends Horde_Kolab_Storage_Queriable public function listFolderTypes(); /** + * Returns the namespace for the list. + * + * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler. + */ + public function getNamespace(); + + /** * Synchronize the list information with the information from the backend. * * @return NULL diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Base.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Base.php index 6bcae18ad..2dc8cbe02 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Base.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Base.php @@ -88,6 +88,16 @@ implements Horde_Kolab_Storage_List } /** + * Returns the namespace for the list. + * + * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler. + */ + public function getNamespace() + { + return $this->_driver->getNamespace(); + } + + /** * Synchronize the list information with the information from the backend. * * @return NULL diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Cache.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Cache.php index 5f1d963e6..31bf407b3 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Cache.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Cache.php @@ -114,6 +114,16 @@ implements Horde_Kolab_Storage_List } /** + * Returns the namespace for the list. + * + * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler. + */ + public function getNamespace() + { + return $this->_list->getNamespace(); + } + + /** * Synchronize the list information with the information from the backend. * * @return NULL diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Log.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Log.php index c9476d82a..ae154e2a3 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Log.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Log.php @@ -117,6 +117,16 @@ implements Horde_Kolab_Storage_List } /** + * Returns the namespace for the list. + * + * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler. + */ + public function getNamespace() + { + return $this->_list->getNamespace(); + } + + /** * Synchronize the list information with the information from the backend. * * @return NULL diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Query.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Query.php index f63cf7287..d3d3346f8 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Query.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Query.php @@ -52,4 +52,24 @@ extends Horde_Kolab_Storage_Query * @return array The list of folders. */ public function listByType($type); + + /** + * Get the default folder for a certain type. + * + * @param string $type The type of the share/folder. + * + * @return string|boolean The name of the default folder, false if there is no default. + */ +// public function getDefault($type); + + /** + * Get the default folder for a certain type from a different owner. + * + * @param string $owner The folder owner. + * @param string $type The type of the share/folder. + * + * @return string|boolean The name of the default folder, false if there is no default. + */ +// public function getForeignDefault($owner, $type); + } \ No newline at end of file diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php index 4cac408a0..ff3f32078 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php @@ -65,6 +65,15 @@ extends Horde_Kolab_Storage_TestCase $this->assertType('array', $list->listFolderTypes()); } + public function testGetNamespace() + { + $list = $this->getNullList(); + $this->assertInstanceOf( + 'Horde_Kolab_Storage_Folder_Namespace', + $list->getNamespace() + ); + } + public function testListQueriable() { $list = new Horde_Kolab_Storage_List_Base( @@ -106,4 +115,5 @@ extends Horde_Kolab_Storage_TestCase $list->getQuery('Horde_Kolab_Storage_Stub_FactoryQuery') ); } + } diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php index a85589c85..cb5169a81 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php @@ -325,6 +325,18 @@ extends Horde_Kolab_Storage_TestCase $list->listFolders(); } + public function testGetNamespace() + { + $list = new Horde_Kolab_Storage_List_Decorator_Cache( + $this->getNullList(), + $this->getMockListCache() + ); + $this->assertInstanceOf( + 'Horde_Kolab_Storage_Folder_Namespace', + $list->getNamespace() + ); + } + public function testGetQuery() { $factory = new Horde_Kolab_Storage_Factory(); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php index 3f3b6205e..046288577 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php @@ -65,6 +65,18 @@ extends Horde_Kolab_Storage_TestCase $this->assertLogContains('List for test@example.com@mock:0 contained 4 folders and annotations.'); } + public function testGetNamespace() + { + $list = new Horde_Kolab_Storage_List_Decorator_Log( + $this->getNullList(), + $this->getMockLogger() + ); + $this->assertInstanceOf( + 'Horde_Kolab_Storage_Folder_Namespace', + $list->getNamespace() + ); + } + public function testGetQuery() { $factory = new Horde_Kolab_Storage_Factory(); -- 2.11.0