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 ba2bc8c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/unit/controller/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit ba2bc8c

Please sign in to comment.