public function testDownloadShare()
 {
     // Test with a password protected share and no authentication
     $response = $this->shareController->downloadShare($this->token);
     $expectedResponse = new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate', array('token' => $this->token)));
     $this->assertEquals($expectedResponse, $response);
 }
예제 #2
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Owner of the share does not exist anymore
  */
 public function testShowShareWithNotExistingUser()
 {
     $this->container['UserManager']->expects($this->once())->method('userExists')->with($this->user)->will($this->returnValue(false));
     $linkItem = Share::getShareByToken($this->token, false);
     \OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
     $this->shareController->showShare($this->token);
 }
예제 #3
0
 public function testDownloadShare()
 {
     $share = $this->getMock('\\OCP\\Share\\IShare');
     $share->method('getPassword')->willReturn('password');
     $this->shareManager->expects($this->once())->method('getShareByToken')->with('validtoken')->willReturn($share);
     $this->urlGenerator->expects($this->once())->method('linkToRoute')->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken'])->willReturn('redirect');
     // Test with a password protected share and no authentication
     $response = $this->shareController->downloadShare('validtoken');
     $expectedResponse = new RedirectResponse('redirect');
     $this->assertEquals($expectedResponse, $response);
 }