--- /dev/null
+<?php
+/**
+ * The cached list query.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * The cached list query.
+ *
+ * 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
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_List_Query_Cache
+implements Horde_Kolab_Storage_List_Query
+{
+ /** The folder type list */
+ const TYPES = 'TYPES';
+
+ /** The folder list sorted by type */
+ const BY_TYPE = 'BY_TYPE';
+
+ /**
+ * The queriable list.
+ *
+ * @var Horde_Kolab_Storage_List
+ */
+ private $_list;
+
+ /**
+ * The list cache.
+ *
+ * @var Horde_Kolab_Storage_Cache_List
+ */
+ private $_list_cache;
+
+ /**
+ * The factory for generating additional resources.
+ *
+ * @var Horde_Kolab_Storage_Factory
+ */
+ private $_factory;
+
+ /**
+ * Constructor.
+ *
+ * @param Horde_Kolab_Storage_List $list The queriable list.
+ * @param Horde_Kolab_Storage_Factory $factory The factory.
+ * @param Horde_Kolab_Storage_Cache_List $list_cache The list cache.
+ */
+ public function __construct(
+ Horde_Kolab_Storage_List $list,
+ Horde_Kolab_Storage_Factory $factory,
+ Horde_Kolab_Storage_Cache_List $list_cache
+ ) {
+ $this->_list = $list;
+ $this->_list_cache = $list_cache;
+ $this->_factory = $factory;
+ }
+
+ /**
+ * Returns the folder types as associative array.
+ *
+ * @return array The list folder types with the folder names as key and the
+ * type as values.
+ */
+ public function listTypes()
+ {
+ return $this->_list_cache->getQuery(self::TYPES);
+ }
+
+ /**
+ * Returns the folder type annotation as associative array.
+ *
+ * @return array The list folder types with the folder names as key and the
+ * type handler as values.
+ */
+ public function listFolderTypeAnnotations()
+ {
+ $result = array();
+ $list = $this->_list_cache->getFolderTypes();
+ foreach ($list as $folder => $annotation) {
+ $result[$folder] = $this->_factory->createFolderType($annotation);
+ }
+ return $result;
+ }
+
+ /**
+ * List all folders of a specific type.
+ *
+ * @param string $type The folder type the listing should be limited to.
+ *
+ * @return array The list of folders.
+ */
+ public function listByType($type)
+ {
+ $by_type = $this->_list_cache->getQuery(self::BY_TYPE);
+ if (isset($by_type[$type])) {
+ return $by_type[$type];
+ } else {
+ return array();
+ }
+ }
+
+ /**
+ * Synchronize the query data with the information from the backend.
+ *
+ * @return NULL
+ */
+ public function synchronize()
+ {
+ $types = array();
+ $by_type = array();
+ foreach ($this->listFolderTypeAnnotations() as $folder => $annotation) {
+ $type = $annotation->getType();
+ $types[$folder] = $type;
+ $by_type[$type][] = $folder;
+ }
+ $this->_list_cache->setQuery(self::TYPES, $types);
+ $this->_list_cache->setQuery(self::BY_TYPE, $by_type);
+ }
+}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * The cached list query.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Storage
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Storage
- */
-
-/**
- * The cached list query.
- *
- * 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
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Storage
- */
-class Horde_Kolab_Storage_List_Query_Decorator_Cache
-implements Horde_Kolab_Storage_List_Query
-{
- /** The folder type list */
- const TYPES = 'TYPES';
-
- /** The folder list sorted by type */
- const BY_TYPE = 'BY_TYPE';
-
- /**
- * The queriable list.
- *
- * @var Horde_Kolab_Storage_List
- */
- private $_list;
-
- /**
- * The list cache.
- *
- * @var Horde_Kolab_Storage_Cache_List
- */
- private $_list_cache;
-
- /**
- * The factory for generating additional resources.
- *
- * @var Horde_Kolab_Storage_Factory
- */
- private $_factory;
-
- /**
- * Constructor.
- *
- * @param Horde_Kolab_Storage_List $list The queriable list.
- * @param Horde_Kolab_Storage_Factory $factory The factory.
- * @param Horde_Kolab_Storage_Cache_List $list_cache The list cache.
- */
- public function __construct(
- Horde_Kolab_Storage_List $list,
- Horde_Kolab_Storage_Factory $factory,
- Horde_Kolab_Storage_Cache_List $list_cache
- ) {
- $this->_list = $list;
- $this->_list_cache = $list_cache;
- $this->_factory = $factory;
- }
-
- /**
- * Returns the folder types as associative array.
- *
- * @return array The list folder types with the folder names as key and the
- * type as values.
- */
- public function listTypes()
- {
- return $this->_list_cache->getQuery(self::TYPES);
- }
-
- /**
- * Returns the folder type annotation as associative array.
- *
- * @return array The list folder types with the folder names as key and the
- * type handler as values.
- */
- public function listFolderTypeAnnotations()
- {
- $result = array();
- $list = $this->_list_cache->getFolderTypes();
- foreach ($list as $folder => $annotation) {
- $result[$folder] = $this->_factory->createFolderType($annotation);
- }
- return $result;
- }
-
- /**
- * List all folders of a specific type.
- *
- * @param string $type The folder type the listing should be limited to.
- *
- * @return array The list of folders.
- */
- public function listByType($type)
- {
- $by_type = $this->_list_cache->getQuery(self::BY_TYPE);
- if (isset($by_type[$type])) {
- return $by_type[$type];
- } else {
- return array();
- }
- }
-
- /**
- * Synchronize the query data with the information from the backend.
- *
- * @return NULL
- */
- public function synchronize()
- {
- $types = array();
- $by_type = array();
- foreach ($this->listFolderTypeAnnotations() as $folder => $annotation) {
- $type = $annotation->getType();
- $types[$folder] = $type;
- $by_type[$type][] = $folder;
- }
- $this->_list_cache->setQuery(self::TYPES, $types);
- $this->_list_cache->setQuery(self::BY_TYPE, $by_type);
- }
-}
\ No newline at end of file
<email>jan@horde.org</email>
<active>yes</active>
</lead>
- <date>2011-01-03</date>
- <time>17:20:40</time>
+ <date>2011-01-04</date>
+ <time>06:58:27</time>
<version>
<release>0.4.0</release>
<api>0.1.0</api>
<file name="Log.php" role="php" />
</dir> <!-- /lib/Horde/Kolab/Storage/List/Decorator -->
<dir name="Query">
- <dir name="Decorator">
- <file name="Cache.php" role="php" />
- </dir> <!-- /lib/Horde/Kolab/Storage/List/Query/Decorator -->
<file name="Base.php" role="php" />
+ <file name="Cache.php" role="php" />
</dir> <!-- /lib/Horde/Kolab/Storage/List/Query -->
<file name="Base.php" role="php" />
<file name="Query.php" role="php" />
</dir> <!-- /test/Horde/Kolab/Storage/Unit/List/Decorator -->
<dir name="Query">
<file name="BaseTest.php" role="test" />
+ <file name="CacheTest.php" role="test" />
</dir> <!-- /test/Horde/Kolab/Storage/Unit/List/Query -->
<file name="BaseTest.php" role="test" />
</dir> <!-- /test/Horde/Kolab/Storage/Unit/List -->
<install as="Horde/Kolab/Storage/List/Decorator/Cache.php" name="lib/Horde/Kolab/Storage/List/Decorator/Cache.php" />
<install as="Horde/Kolab/Storage/List/Decorator/Log.php" name="lib/Horde/Kolab/Storage/List/Decorator/Log.php" />
<install as="Horde/Kolab/Storage/List/Query/Base.php" name="lib/Horde/Kolab/Storage/List/Query/Base.php" />
- <install as="Horde/Kolab/Storage/List/Query/Decorator/Cache.php" name="lib/Horde/Kolab/Storage/List/Query/Decorator/Cache.php" />
+ <install as="Horde/Kolab/Storage/List/Query/Cache.php" name="lib/Horde/Kolab/Storage/List/Query/Cache.php" />
<install as="locale/Horde_Kolab_Storage.pot" name="locale/Horde_Kolab_Storage.pot" />
<install as="locale/ar/LC_MESSAGES/Horde_Kolab_Storage.mo" name="locale/ar/LC_MESSAGES/Horde_Kolab_Storage.mo" />
<install as="locale/ar/LC_MESSAGES/Horde_Kolab_Storage.po" name="locale/ar/LC_MESSAGES/Horde_Kolab_Storage.po" />
<install as="Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php" name="test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php" />
<install as="Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php" name="test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php" />
<install as="Horde/Kolab/Storage/Unit/List/Query/BaseTest.php" name="test/Horde/Kolab/Storage/Unit/List/Query/BaseTest.php" />
+ <install as="Horde/Kolab/Storage/Unit/List/Query/CacheTest.php" name="test/Horde/Kolab/Storage/Unit/List/Query/CacheTest.php" />
<install as="TODO" name="TODO" />
</filelist>
</phprelease>
<release>alpha</release>
<api>alpha</api>
</stability>
- <date>2011-01-03</date>
+ <date>2011-01-04</date>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
<notes>
* Added namespace support (Bug #6691).
$bare_list,
$list_cache
);
- $query = new Horde_Kolab_Storage_List_Query_Decorator_Cache(
+ $query = new Horde_Kolab_Storage_List_Query_Cache(
$list,
$factory,
$list_cache
--- /dev/null
+<?php
+/**
+ * Test the cached list query.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @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 cached list query.
+ *
+ * Copyright 2011 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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_Unit_List_Query_CacheTest
+extends Horde_Kolab_Storage_TestCase
+{
+ public function testAnotationsReturnsArray()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
+ $this->assertType('array', $query->listFolderTypeAnnotations());
+ }
+
+ public function testAnnotationsReturnsHandlers()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ foreach ($query->listFolderTypeAnnotations() as $folder => $type) {
+ $this->assertInstanceOf('Horde_Kolab_Storage_Folder_Type', $type);
+ };
+ }
+
+ public function testTypeReturnsArray()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
+ $this->assertType('array', $query->listTypes());
+ }
+
+ public function testTypeReturnsAnnotations()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertEquals(
+ array(
+ 'INBOX/Calendar' => 'event',
+ 'INBOX/Contacts' => 'contact',
+ 'INBOX/Notes' => 'note',
+ 'INBOX/Tasks' => 'task',
+ ),
+ $query->listTypes()
+ );
+ }
+
+ public function testByTypeReturnsArray()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
+ $this->assertType('array', $query->listByType('test'));
+ }
+
+ public function testListCalendarsListsCalendars()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertEquals(array('INBOX/Calendar'), $query->listByType('event'));
+ }
+
+ public function testListTasklistsListsTasklists()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertEquals(array('INBOX/Tasks'), $query->listByType('task'));
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * Test the cached list query.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Storage
- * @subpackage UnitTests
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 cached list query.
- *
- * Copyright 2011 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 <wrobel@pardus.de>
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Storage
- */
-class Horde_Kolab_Storage_Unit_List_Query_Decorator_CacheTest
-extends Horde_Kolab_Storage_TestCase
-{
- public function testAnotationsReturnsArray()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
- $this->assertType('array', $query->listFolderTypeAnnotations());
- }
-
- public function testAnnotationsReturnsHandlers()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
- foreach ($query->listFolderTypeAnnotations() as $folder => $type) {
- $this->assertInstanceOf('Horde_Kolab_Storage_Folder_Type', $type);
- };
- }
-
- public function testTypeReturnsArray()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
- $this->assertType('array', $query->listTypes());
- }
-
- public function testTypeReturnsAnnotations()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
- $this->assertEquals(
- array(
- 'INBOX/Calendar' => 'event',
- 'INBOX/Contacts' => 'contact',
- 'INBOX/Notes' => 'note',
- 'INBOX/Tasks' => 'task',
- ),
- $query->listTypes()
- );
- }
-
- public function testByTypeReturnsArray()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getNullList($factory), $factory);
- $this->assertType('array', $query->listByType('test'));
- }
-
- public function testListCalendarsListsCalendars()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
- $this->assertEquals(array('INBOX/Calendar'), $query->listByType('event'));
- }
-
- public function testListTasklistsListsTasklists()
- {
- $factory = new Horde_Kolab_Storage_Factory();
- $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
- $this->assertEquals(array('INBOX/Tasks'), $query->listByType('task'));
- }
-
-}