$perm = $share->getPermission();
$this->assertInstanceOf('Horde_Perms_Permission', $perm);
$perm->addDefaultPermission(Horde_Perms::SHOW | Horde_Perms::READ);
+ $perm->addGuestPermission(Horde_Perms::SHOW);
$share->setPermission($perm);
$share->save();
$this->assertTrue($share->hasPermission('john', Horde_Perms::SHOW));
// Getting shares from cache.
$share = self::$share->getShare('myshare');
$this->assertInstanceOf('Horde_Share_Object', $share);
+ try {
+ self::$share->getShare('nonexistant');
+ $this->fail('Share "nonexistant" was expected to not exist.');
+ } catch (Horde_Exception_NotFound $e) {
+ }
// Reset cache.
self::$share->resetCache();
{
// Getting shares from cache.
$this->_getShareById($shares);
+ try {
+ self::$share->getShareById(99999);
+ $this->fail('Share 99999 was expected to not exist.');
+ } catch (Horde_Exception_NotFound $e) {
+ }
// Reset cache.
self::$share->resetCache();
$this->assertEquals(array('john', 'jane'), $janeshare->listUsers(Horde_Perms::EDIT));
$this->assertEquals(array('jane'), $janeshare->listUsers(Horde_Perms::DELETE));
$this->assertEquals('Jane\'s Share', $janeshare->get('name'));
+ $this->assertTrue($janeshare->hasPermission('john', Horde_Perms::EDIT));
+ $this->assertTrue($janeshare->hasPermission('jane', 99999));
$groupshare = self::$share->getShareById($shares[2]->getId());
$this->assertInstanceOf('Horde_Share_Object', $groupshare);
$this->assertEquals($shareids[1], $shares[0]->getId());
$this->assertEquals($shareids[2], $shares[1]->getId());
+ // Guest shares.
+ $share = self::$share->getShareById(2);
+ $shares = array_values(self::$share->listShares(false, array('perm' => Horde_Perms::SHOW, 'sort_by' => 'id')));
+ $this->assertType('array', $shares);
+ $this->assertEquals(1, count($shares));
+ $this->assertEquals('System Share', $shares[0]->get('name'));
+
// Shares with certain permissions.
$this->assertEquals(4, count(self::$share->listShares('john', array('perm' => Horde_Perms::READ))));
$shares = array_values(self::$share->listShares('john', array('perm' => Horde_Perms::EDIT, 'sort_by' => 'id')));
} catch (Horde_Exception_NotFound $e) {
}
}
+
+ public function callback($share)
+ {
+ $share->setShareOb(new Horde_Support_Stub());
+ $this->assertEquals($share, unserialize(serialize($share)));
+ }
}
class Horde_Group_Test extends Horde_Group {
parent::removeShare($share);
}
+ public function testCallback()
+ {
+ parent::callback(new Horde_Share_Object_Sql_Hierarchical(array()));
+ }
+
+ public function testListOwners()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testCountOwners()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testCountChildren()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testGetParent()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testGetParents()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testSetParent()
+ {
+ $this->markTestIncomplete();
+ }
+
public static function setUpBeforeClass()
{
$migration = new Horde_Db_Migration_Base(self::$db);