|
|
@ -263,10 +263,17 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true); |
|
|
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true); |
|
|
$this->session->method('get')->with('public_link_authenticated')->willReturn('42'); |
|
|
$this->session->method('get')->with('public_link_authenticated')->willReturn('42'); |
|
|
|
|
|
|
|
|
$this->urlGenerator->expects($this->at(0)) |
|
|
|
|
|
|
|
|
$this->urlGenerator->expects($this->exactly(3)) |
|
|
->method('linkToRouteAbsolute') |
|
|
->method('linkToRouteAbsolute') |
|
|
->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]) |
|
|
|
|
|
->willReturn('downloadURL'); |
|
|
|
|
|
|
|
|
->withConsecutive( |
|
|
|
|
|
['files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]], |
|
|
|
|
|
['files_sharing.sharecontroller.showShare', ['token' => 'token']], |
|
|
|
|
|
['files_sharing.PublicPreview.getPreview', ['token' => 'token', 'x' => 200, 'y' => 200, 'file' => '/'.$filename]], |
|
|
|
|
|
)->willReturnOnConsecutiveCalls( |
|
|
|
|
|
'downloadURL', |
|
|
|
|
|
'shareUrl', |
|
|
|
|
|
'previewImage', |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
|
|
|
|
|
|
@ -343,8 +350,8 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
'hideFileList' => false, |
|
|
'hideFileList' => false, |
|
|
'shareOwner' => 'ownerDisplay', |
|
|
'shareOwner' => 'ownerDisplay', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'shareUrl' => null, |
|
|
|
|
|
'previewImage' => null, |
|
|
|
|
|
|
|
|
'shareUrl' => 'shareUrl', |
|
|
|
|
|
'previewImage' => 'previewImage', |
|
|
'previewURL' => 'downloadURL', |
|
|
'previewURL' => 'downloadURL', |
|
|
'note' => $note, |
|
|
'note' => $note, |
|
|
'hideDownload' => false, |
|
|
'hideDownload' => false, |
|
|
@ -414,10 +421,17 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true); |
|
|
$this->session->method('exists')->with('public_link_authenticated')->willReturn(true); |
|
|
$this->session->method('get')->with('public_link_authenticated')->willReturn('42'); |
|
|
$this->session->method('get')->with('public_link_authenticated')->willReturn('42'); |
|
|
|
|
|
|
|
|
$this->urlGenerator->expects($this->at(0)) |
|
|
|
|
|
|
|
|
$this->urlGenerator->expects($this->exactly(3)) |
|
|
->method('linkToRouteAbsolute') |
|
|
->method('linkToRouteAbsolute') |
|
|
->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]) |
|
|
|
|
|
->willReturn('downloadURL'); |
|
|
|
|
|
|
|
|
->withConsecutive( |
|
|
|
|
|
['files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]], |
|
|
|
|
|
['files_sharing.sharecontroller.showShare', ['token' => 'token']], |
|
|
|
|
|
['files_sharing.PublicPreview.getPreview', ['token' => 'token', 'x' => 200, 'y' => 200, 'file' => '/'.$filename]], |
|
|
|
|
|
)->willReturnOnConsecutiveCalls( |
|
|
|
|
|
'downloadURL', |
|
|
|
|
|
'shareUrl', |
|
|
|
|
|
'previewImage', |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
|
|
|
|
|
|
@ -494,8 +508,8 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
'hideFileList' => false, |
|
|
'hideFileList' => false, |
|
|
'shareOwner' => '', |
|
|
'shareOwner' => '', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'shareUrl' => null, |
|
|
|
|
|
'previewImage' => null, |
|
|
|
|
|
|
|
|
'shareUrl' => 'shareUrl', |
|
|
|
|
|
'previewImage' => 'previewImage', |
|
|
'previewURL' => 'downloadURL', |
|
|
'previewURL' => 'downloadURL', |
|
|
'note' => $note, |
|
|
'note' => $note, |
|
|
'hideDownload' => false, |
|
|
'hideDownload' => false, |
|
|
@ -569,10 +583,17 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
// Even if downloads are disabled the "downloadURL" parameter is
|
|
|
// Even if downloads are disabled the "downloadURL" parameter is
|
|
|
// provided to the template, as it is needed to preview audio and GIF
|
|
|
// provided to the template, as it is needed to preview audio and GIF
|
|
|
// files.
|
|
|
// files.
|
|
|
$this->urlGenerator->expects($this->at(0)) |
|
|
|
|
|
|
|
|
$this->urlGenerator->expects($this->exactly(3)) |
|
|
->method('linkToRouteAbsolute') |
|
|
->method('linkToRouteAbsolute') |
|
|
->with('files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]) |
|
|
|
|
|
->willReturn('downloadURL'); |
|
|
|
|
|
|
|
|
->withConsecutive( |
|
|
|
|
|
['files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename]], |
|
|
|
|
|
['files_sharing.sharecontroller.showShare', ['token' => 'token']], |
|
|
|
|
|
['files_sharing.PublicPreview.getPreview', ['token' => 'token', 'x' => 200, 'y' => 200, 'file' => '/'.$filename]], |
|
|
|
|
|
)->willReturnOnConsecutiveCalls( |
|
|
|
|
|
'downloadURL', |
|
|
|
|
|
'shareUrl', |
|
|
|
|
|
'previewImage', |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
$this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |
|
|
|
|
|
|
|
|
@ -645,8 +666,8 @@ class ShareControllerTest extends \Test\TestCase { |
|
|
'hideFileList' => false, |
|
|
'hideFileList' => false, |
|
|
'shareOwner' => 'ownerDisplay', |
|
|
'shareOwner' => 'ownerDisplay', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'disclaimer' => 'My disclaimer text', |
|
|
'shareUrl' => null, |
|
|
|
|
|
'previewImage' => null, |
|
|
|
|
|
|
|
|
'shareUrl' => 'shareUrl', |
|
|
|
|
|
'previewImage' => 'previewImage', |
|
|
'previewURL' => 'downloadURL', |
|
|
'previewURL' => 'downloadURL', |
|
|
'note' => $note, |
|
|
'note' => $note, |
|
|
'hideDownload' => true, |
|
|
'hideDownload' => true, |
|
|
|