]> source.dussan.org Git - nextcloud-server.git/commitdiff
Unit test for delete lazy shares
authorRoeland Jago Douma <rullzer@owncloud.com>
Thu, 4 Feb 2016 12:28:48 +0000 (13:28 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Thu, 4 Feb 2016 12:30:42 +0000 (13:30 +0100)
tests/lib/share20/defaultshareprovidertest.php

index 86b89351611c1327ece1e7d95c175826d1cc25fc..600249896816526f83376994c2bd7a56924f4897 100644 (file)
@@ -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')