protected $_storage;
/**
- * The share type
+ * The folder type in the storage backend.
*
* @var string
*/
protected $_listCacheValidity;
/**
+ * Constructor.
+ *
+ * @param string $app The application that the shares belong to
+ * @param string $user The current user
+ * @param Horde_Perms $perms The permissions object
+ * @param Horde_Group $groups The Horde_Group object
+ *
+ */
+ public function __construct($app, $user, Horde_Perms $perms, Horde_Group $groups)
+ {
+ switch ($app) {
+ case 'mnemo':
+ $this->_type = 'note';
+ break;
+ case 'kronolith':
+ $this->_type = 'event';
+ break;
+ case 'turba':
+ $this->_type = 'contact';
+ break;
+ case 'nag':
+ $this->_type = 'task';
+ break;
+ default:
+ throw new Horde_Share_Exception(sprintf(Horde_Share_Translation::t("The Horde/Kolab integration engine does not support \"%s\""), $app));
+ }
+ parent::__construct($app, $user, $perms, $groups);
+ }
+
+ /**
* Set the Kolab storage backend.
*
* @param Horde_Kolab_Storage $driver The Kolab storage driver.
return array();
}
-
- private function _getFolderType($app)
+ /**
+ * Return the type of folder this share driver will access in the Kolab
+ * storage backend (depends on the application calling the share driver).
+ *
+ * @return string
+ */
+ public function getType()
{
- switch ($app) {
- case 'mnemo':
- return 'note';
- case 'kronolith':
- return 'event';
- case 'turba':
- return 'contact';
- case 'nag':
- return 'task';
- default:
- throw new Horde_Share_Exception(sprintf(Horde_Share_Translation::t("The Horde/Kolab integration engine does not support \"%s\""), $app));
- }
+ return $this->_type;
}
-
+
/**
* (re)connect the share object to this share driver. Userful for when
* share objects are unserialized from a cache separate from the share
);
}
+ public function testGetTypeString()
+ {
+ $driver = new Horde_Share_Kolab(
+ 'mnemo', 'john', new Horde_Perms(), new Horde_Group_Test()
+ );
+ $this->assertType('string', $driver->getType());
+ }
+
+ public function testMnemoSupport()
+ {
+ $driver = new Horde_Share_Kolab(
+ 'mnemo', 'john', new Horde_Perms(), new Horde_Group_Test()
+ );
+ $this->assertEquals('note', $driver->getType());
+ }
+
+ public function testKronolithSupport()
+ {
+ $driver = new Horde_Share_Kolab(
+ 'kronolith', 'john', new Horde_Perms(), new Horde_Group_Test()
+ );
+ $this->assertEquals('event', $driver->getType());
+ }
+
+ public function testTurbaSupport()
+ {
+ $driver = new Horde_Share_Kolab(
+ 'turba', 'john', new Horde_Perms(), new Horde_Group_Test()
+ );
+ $this->assertEquals('contact', $driver->getType());
+ }
+
+ public function testNagSupport()
+ {
+ $driver = new Horde_Share_Kolab(
+ 'nag', 'john', new Horde_Perms(), new Horde_Group_Test()
+ );
+ $this->assertEquals('task', $driver->getType());
+ }
+
+ /**
+ * @todo: Reminder: Check that external modification of the Storage system
+ * works (former list->validity).
+ */
+
private function _getCompleteDriver()
{
$factory = new Horde_Kolab_Storage_Factory();
private function _getDriver()
{
return new Horde_Share_Kolab(
- 'test', 'john', new Horde_Perms(), new Horde_Group_Test()
+ 'mnemo', 'john', new Horde_Perms(), new Horde_Group_Test()
);
}
}
\ No newline at end of file