Skip to content

Commit

Permalink
Issue owncloud#565: Tests Updated for Issue owncloud#565(PR owncloud#587
Browse files Browse the repository at this point in the history
)
  • Loading branch information
imjalpreet committed Mar 17, 2016
1 parent 0f7858e commit 8bd43ae
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/unit/controller/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 8bd43ae

Please sign in to comment.