From 8bd43aef44f83ac6791f8dd51117e2186f8207a4 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 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index d46120042c..360558ecb1 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -71,10 +71,15 @@ protected function setUp() { public function testIndex() { $url = 'http://owncloud/ajax/upload.php'; $this->mockUrlToUploadEndpoint($url); + $publicUpload = 'yes'; + $publicUploadEnabled = true; $params = [ 'appName' => $this->appName, - 'uploadUrl' => $url + 'uploadUrl' => $url, + 'publicUploadEnabled' => $publicUploadEnabled ]; + $this->mockGetPublicUploadAppValue($publicUpload); + $template = new TemplateResponse($this->appName, 'index', $params); $response = $this->controller->index(); @@ -231,6 +236,17 @@ private function mockUrlToDownloadPage($token, $fileId, $filename, $url) { ->willReturn($url); } + private function mockGetPublicUploadAppValue($publicUpload) { + $this->appConfig->expects($this->once()) + ->method('getAppValue') + ->with( + 'core', + 'shareapi_allow_public_upload', + 'yes' + ) + ->willReturn($publicUpload); + } + /** * Needs to be called at least once by testDownloadWithWrongId() or the tests will fail *