}
/**
+ * Retrieves the specified annotation for the complete list of mailboxes.
+ *
+ * @param string $annotation The name of the annotation to retrieve.
+ *
+ * @return array An associative array combining the folder names as key with
+ * the corresponding annotation value.
+ */
+ public function listAnnotation($annotation)
+ {
+ $this->_logger->info(
+ sprintf('Driver "%s": Listing annotation "%s".', $this->getDriverName(), $annotation)
+ );
+ $result = parent::listAnnotation($annotation);
+ $this->_logger->info(
+ sprintf(
+ 'Driver "%s": List contained %s folder annotations.',
+ $this->getDriverName(),
+ count($result))
+ );
+ return $result;
+ }
+
+ /**
* Does the given folder exist?
*
* @param string $folder The folder to check.
}
/**
+ * Retrieves the specified annotation for the complete list of mailboxes.
+ *
+ * @param string $annotation The name of the annotation to retrieve.
+ *
+ * @return array An associative array combining the folder names as key with
+ * the corresponding annotation value.
+ */
+ public function listAnnotation($annotation)
+ {
+ $this->_timer->push();
+ $result = parent::listAnnotation($annotation);
+ $this->_logger->info(
+ sprintf(
+ 'REQUEST OUT IMAP: %s ms [listAnnotation]',
+ floor($this->_timer->pop() * 1000)
+ )
+ );
+ return $result;
+ }
+
+ /**
* Does the given folder exist?
*
* @param string $folder The folder to check.
*/
public function getQuery($name)
{
+ return $this->getQueryWithParent($name, $this);
+ }
+
+ /**
+ * Return the specified query type based on the specified parent object.
+ *
+ * @param string $name The query name.
+ * @param Horde_Kolab_Storage_List $parent The base for the query object.
+ *
+ * @return Horde_Kolab_Storage_Query A query handler.
+ *
+ * @throws Horde_Kolab_Storage_Exception In case the requested query is not supported.
+ */
+ public function getQueryWithParent($name, Horde_Kolab_Storage_List $parent)
+ {
$class = 'Horde_Kolab_Storage_List_Query_' . $name;
if (class_exists($class)) {
- return new $class($this);
+ return new $class($parent);
}
throw new Horde_Kolab_Storage_Exception(sprintf('No such query "%s"!', $name));
}
*/
public function getQuery($name)
{
- return $this->_list->getQuery($name);
+ return $this->_list->getQueryWithParent($name, $this);
}
}
\ No newline at end of file
$driver->getMailboxes();
$this->assertLogContains('Driver "Horde_Kolab_Storage_Driver_Mock": List contained 2 folders.');
}
+
+ public function testListAnnotationLogsEntry()
+ {
+ $driver = new Horde_Kolab_Storage_Driver_Decorator_Log(
+ $this->getNullMock(),
+ $this->getMockLogger()
+ );
+ $driver->listAnnotation('/shared/vendor/kolab/folder-type');
+ $this->assertLogCount(2);
+ }
+
+ public function testListAnnotationFolderCount()
+ {
+ $driver = new Horde_Kolab_Storage_Driver_Decorator_Log(
+ $this->getAnnotatedMock(),
+ $this->getMockLogger()
+ );
+ $driver->listAnnotation('/shared/vendor/kolab/folder-type');
+ $this->assertLogContains('Driver "Horde_Kolab_Storage_Driver_Mock": List contained 4 folder annotations.');
+ }
}
$driver->getMailboxes();
$this->assertLogRegExp('/REQUEST OUT IMAP:.*getMailboxes.*/');
}
+
+ public function testListAnnotationLogsEntry()
+ {
+ $driver = new Horde_Kolab_Storage_Driver_Decorator_Timer(
+ $this->getNullMock(),
+ new Horde_Support_Timer(),
+ $this->getMockLogger()
+ );
+ $driver->listAnnotation('/shared/vendor/kolab/folder-type');
+ $this->assertLogCount(1);
+ }
+
+ public function testListAnnotationFolderCount()
+ {
+ $driver = new Horde_Kolab_Storage_Driver_Decorator_Timer(
+ $this->getTwoFolderMock(),
+ new Horde_Support_Timer(),
+ $this->getMockLogger()
+ );
+ $driver->listAnnotation('/shared/vendor/kolab/folder-type');
+ $this->assertLogRegExp('/REQUEST OUT IMAP:.*listAnnotation.*/');
+ }
}