diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-04 13:28:48 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-04 13:30:42 +0100 |
commit | 2c0cb5a00eb15bfb233bb29de1156e7e35d84743 (patch) | |
tree | 72e182f4e0dbf20d2a4203836b266b8de63f417e /tests | |
parent | e0bc128eb55cb2cde1a28545a9e2e12bdcd8d53a (diff) | |
download | nextcloud-server-2c0cb5a00eb15bfb233bb29de1156e7e35d84743.tar.gz nextcloud-server-2c0cb5a00eb15bfb233bb29de1156e7e35d84743.zip |
Unit test for delete lazy shares
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share20/defaultshareprovidertest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/share20/defaultshareprovidertest.php b/tests/lib/share20/defaultshareprovidertest.php index 86b89351611..60024989681 100644 --- a/tests/lib/share20/defaultshareprovidertest.php +++ b/tests/lib/share20/defaultshareprovidertest.php @@ -449,6 +449,39 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEmpty($result); } + public function testDeleteSingleShareLazy() { + $qb = $this->dbConn->getQueryBuilder(); + $qb->insert('share') + ->values([ + 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_with' => $qb->expr()->literal('sharedWith'), + 'uid_owner' => $qb->expr()->literal('shareOwner'), + 'uid_initiator' => $qb->expr()->literal('sharedBy'), + 'item_type' => $qb->expr()->literal('file'), + 'file_source' => $qb->expr()->literal(42), + 'file_target' => $qb->expr()->literal('myTarget'), + 'permissions' => $qb->expr()->literal(13), + ]); + $this->assertEquals(1, $qb->execute()); + + $id = $qb->getLastInsertId(); + + $this->rootFolder->expects($this->never())->method($this->anything()); + + $share = $this->provider->getShareById($id); + $this->provider->delete($share); + + $qb = $this->dbConn->getQueryBuilder(); + $qb->select('*') + ->from('share'); + + $cursor = $qb->execute(); + $result = $cursor->fetchAll(); + $cursor->closeCursor(); + + $this->assertEmpty($result); + } + public function testDeleteGroupShareWithUserGroupShares() { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') |