summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-02-28 17:35:42 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-02-28 17:35:42 +0100
commit8c69d783e0f32394d1d37c059bd55e648dcbba93 (patch)
tree5520d79095e7dd539f6d3c95e4d933c5ed475d81 /apps
parenta0641e43dc0db58bd31bc097b15c19784e09f50b (diff)
downloadnextcloud-server-8c69d783e0f32394d1d37c059bd55e648dcbba93.tar.gz
nextcloud-server-8c69d783e0f32394d1d37c059bd55e648dcbba93.zip
Fixed tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php2
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php10
2 files changed, 6 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index f793d35e3ae..c4d9e739658 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -174,7 +174,7 @@ class ShareController extends Controller {
* @param string $password
* @return RedirectResponse|TemplateResponse|NotFoundResponse
*/
- public function authenticate($token, $redirect, $password = '') {
+ public function authenticate($token, $redirect = 'preview', $password = '') {
// Check whether share exists
try {
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 6dc577a354c..28f81395b9d 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -249,7 +249,7 @@ class ShareControllerTest extends \Test\TestCase {
->with('files_sharing.sharecontroller.showShare', ['token'=>'token'])
->willReturn('redirect');
- $response = $this->shareController->authenticate('token', 'validpassword');
+ $response = $this->shareController->authenticate('token', 'preview', 'validpassword');
$expectedResponse = new RedirectResponse('redirect');
$this->assertEquals($expectedResponse, $response);
}
@@ -292,7 +292,7 @@ class ShareControllerTest extends \Test\TestCase {
$data['errorMessage'] === 'Wrong password';
}));
- $response = $this->shareController->authenticate('token', 'invalidpassword');
+ $response = $this->shareController->authenticate('token', 'preview', 'invalidpassword');
$expectedResponse = new TemplateResponse($this->appName, 'authenticate', array('wrongpw' => true), 'guest');
$expectedResponse->throttle();
$this->assertEquals($expectedResponse, $response);
@@ -323,7 +323,7 @@ class ShareControllerTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
- ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken'])
+ ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'preview'])
->willReturn('redirect');
// Test without a not existing token
@@ -505,12 +505,12 @@ class ShareControllerTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
- ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken'])
+ ->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'download'])
->willReturn('redirect');
// Test with a password protected share and no authentication
$response = $this->shareController->downloadShare('validtoken');
- $expectedResponse = new RedirectResponse('redirect');
+ $expectedResponse = new RedirectResponse('redirect', '');
$this->assertEquals($expectedResponse, $response);
}