public function _listSharesJohnTwo()
{
// Shares with certain permissions.
$this->assertEquals(5, count(self::$share->listShares('john', array('perm' => Horde_Perms::READ))));
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::EDIT, 'sort_by' => 'id'));
$this->assertSortedById(array('myshare', 'mychildshare', 'janeshare'), $shares);
// Again with only toplevel
$shares = self::$share->listShares('john', array('all_levels' => false, 'perm' => Horde_Perms::EDIT, 'sort_by' => 'id'));
$this->assertSortedById(array('myshare', 'janeshare'), $shares);
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::DELETE, 'sort_by' => 'id'));
$this->assertSortedById(array('myshare', 'mychildshare', 'groupshare'), $shares);
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::EDIT | Horde_Perms::DELETE, 'sort_by' => 'id'));
$this->assertSortedById(array('myshare', 'mychildshare', 'janeshare', 'groupshare'), $shares);
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::ALL));
$this->assertInternalType('array', $shares);
$this->assertEquals(5, count($shares));
// Paging.
$all_shares = self::$share->listShares('john', array('perm' => Horde_Perms::ALL, 'sort_by' => 'id'));
$this->assertSortedById(array('janeshare', 'groupshare', 'myshare', 'mychildshare', 'systemshare'), $all_shares);
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::ALL, 'sort_by' => 'id', 'from' => 2, 'count' => 2));
$this->assertEquals(array_slice(array_keys($all_shares), 2, 2), array_keys($shares));
// Paging with top level only
$all_top_shares = self::$share->listShares('john', array('all_levels' => false, 'perm' => Horde_Perms::ALL, 'sort_by' => 'id'));
$this->assertSortedById(array('janeshare', 'groupshare', 'myshare', 'systemshare'), $all_top_shares);
$shares = self::$share->listShares('john', array('all_levels' => false, 'perm' => Horde_Perms::ALL, 'sort_by' => 'id', 'from' => 2, 'count' => 2));
$this->assertEquals(array_slice(array_keys($all_top_shares), 2, 2), array_keys($shares));
// Restrict to children of a share only
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::ALL, 'parent' => self::$shares['myshare']));
$this->assertEquals(array('mychildshare'), array_keys($shares));
// Sort order and direction.
$shares = self::$share->listShares('john', array('perm' => Horde_Perms::ALL, 'sort_by' => 'id', 'direction' => 1));
$this->assertSortedById(array('groupshare', 'janeshare', 'systemshare', 'mychildshare', 'myshare'), array_reverse($shares));
// Attribute searching.
$shares = self::$share->listShares('john', array('attributes' => array('name' => 'Jane\'s Share')));
$this->assertEquals(array('janeshare'), array_keys($shares));
$shares = self::$share->listShares('john', array('attributes' => array('desc' => '行事曆')));
$this->assertEquals(array('myshare'), array_keys($shares));
}