Ejemplo n.º 1
0
 public function testDeleteShare()
 {
     $share = $this->getMock('OC\\Share20\\IShare');
     $share->method('getSharedBy')->willReturn($this->currentUser);
     $this->shareManager->expects($this->once())->method('getShareById')->with(42)->willReturn($share);
     $this->shareManager->expects($this->once())->method('deleteShare')->with($share);
     $expected = new \OC_OCS_Result();
     $this->assertEquals($expected, $this->ocs->deleteShare(42));
 }
Ejemplo n.º 2
0
 public function testDeleteShare()
 {
     $share = $this->newShare();
     $share->setSharedBy($this->currentUser->getUID());
     $this->shareManager->expects($this->once())->method('getShareById')->with('ocinternal:42')->willReturn($share);
     $this->shareManager->expects($this->once())->method('deleteShare')->with($share);
     $expected = new \OC_OCS_Result();
     $this->assertEquals($expected, $this->ocs->deleteShare(42));
 }
Ejemplo n.º 3
0
 public function testDeleteShareLocked()
 {
     $node = $this->getMock('\\OCP\\Files\\File');
     $share = $this->newShare();
     $share->setSharedBy($this->currentUser->getUID())->setNode($node);
     $this->shareManager->expects($this->once())->method('getShareById')->with('ocinternal:42')->willReturn($share);
     $this->shareManager->expects($this->never())->method('deleteShare')->with($share);
     $node->expects($this->once())->method('lock')->with(\OCP\Lock\ILockingProvider::LOCK_SHARED)->will($this->throwException(new LockedException('mypath')));
     $node->expects($this->never())->method('unlock')->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
     $expected = new \OC_OCS_Result(null, 404, 'could not delete share');
     $this->assertEquals($expected, $this->ocs->deleteShare(42));
 }