aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Controller/PreviewControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Core/Controller/PreviewControllerTest.php')
-rw-r--r--tests/Core/Controller/PreviewControllerTest.php27
1 files changed, 8 insertions, 19 deletions
diff --git a/tests/Core/Controller/PreviewControllerTest.php b/tests/Core/Controller/PreviewControllerTest.php
index e7ecba27064..5a6cd1fba0a 100644
--- a/tests/Core/Controller/PreviewControllerTest.php
+++ b/tests/Core/Controller/PreviewControllerTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -19,7 +20,6 @@ use OCP\Files\Storage\IStorage;
use OCP\IPreview;
use OCP\IRequest;
use OCP\Preview\IMimeIconProvider;
-use OCP\Share\IAttributes;
use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
@@ -196,15 +196,9 @@ class PreviewControllerTest extends \Test\TestCase {
->with($this->equalTo($file))
->willReturn(true);
- $shareAttributes = $this->createMock(IAttributes::class);
- $shareAttributes->expects(self::atLeastOnce())
- ->method('getAttribute')
- ->with('permissions', 'download')
- ->willReturn(false);
-
$share = $this->createMock(IShare::class);
- $share->method('getAttributes')
- ->willReturn($shareAttributes);
+ $share->method('canSeeContent')
+ ->willReturn(false);
$storage = $this->createMock(ISharedStorage::class);
$storage->method('instanceOfStorage')
@@ -242,14 +236,9 @@ class PreviewControllerTest extends \Test\TestCase {
->with($this->equalTo($file))
->willReturn(true);
- $shareAttributes = $this->createMock(IAttributes::class);
- $shareAttributes->method('getAttribute')
- ->with('permissions', 'download')
- ->willReturn(false);
-
$share = $this->createMock(IShare::class);
- $share->method('getAttributes')
- ->willReturn($shareAttributes);
+ $share->method('canSeeContent')
+ ->willReturn(false);
$storage = $this->createMock(ISharedStorage::class);
$storage->method('instanceOfStorage')
@@ -265,7 +254,7 @@ class PreviewControllerTest extends \Test\TestCase {
$this->request
->method('getHeader')
- ->with('X-NC-Preview')
+ ->with('x-nc-preview')
->willReturn('true');
$preview = $this->createMock(ISimpleFile::class);
@@ -341,8 +330,8 @@ class PreviewControllerTest extends \Test\TestCase {
// No attributes set -> download permitted
$share = $this->createMock(IShare::class);
- $share->method('getAttributes')
- ->willReturn(null);
+ $share->method('canSeeContent')
+ ->willReturn(true);
$storage = $this->createMock(ISharedStorage::class);
$storage->method('instanceOfStorage')