From ba2bc8c8a7d998b7b732d8adca87484594b01b0a Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (imjalpreet)" Date: Thu, 17 Mar 2016 20:14:16 +0530 Subject: [PATCH] Issue #565: Tests Updated for Issue #565(PR #587) --- tests/unit/controller/PageControllerTest.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index d46120042c..4b41681ccb 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -71,10 +71,14 @@ protected function setUp() { public function testIndex() { $url = 'http://owncloud/ajax/upload.php'; $this->mockUrlToUploadEndpoint($url); + $publicUploadEnabled = 'yes'; $params = [ 'appName' => $this->appName, - 'uploadUrl' => $url + 'uploadUrl' => $url, + 'publicUploadEnabled' => $publicUploadEnabled ]; + $this->mockGetPublicUploadAppValue($publicUploadEnabled); + $template = new TemplateResponse($this->appName, 'index', $params); $response = $this->controller->index(); @@ -231,6 +235,17 @@ private function mockUrlToDownloadPage($token, $fileId, $filename, $url) { ->willReturn($url); } + private function mockGetPublicUploadAppValue($publicUploadEnabled) { + $this->appConfig->expects($this->once()) + ->method('getAppValue') + ->with( + 'core', + 'shareapi_allow_public_upload', + 'yes' + ) + ->willReturn($publicUploadEnabled); + } + /** * Needs to be called at least once by testDownloadWithWrongId() or the tests will fail *