diff options
Diffstat (limited to 'apps/files/tests/Controller')
-rw-r--r-- | apps/files/tests/Controller/ApiControllerTest.php | 21 | ||||
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 4 |
2 files changed, 8 insertions, 17 deletions
diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index 0c9d7a4fa6e..e74989eb2f5 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -29,7 +29,6 @@ use OCP\IPreview; use OCP\IRequest; use OCP\IUser; use OCP\IUserSession; -use OCP\Share\IAttributes; use OCP\Share\IManager; use OCP\Share\IShare; use PHPUnit\Framework\MockObject\MockObject; @@ -120,7 +119,7 @@ class ApiControllerTest extends TestCase { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) - ->will($this->throwException(new NotFoundException('My error message'))); + ->willThrowException(new NotFoundException('My error message')); $expected = new DataResponse(['message' => 'My error message'], Http::STATUS_NOT_FOUND); $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); @@ -130,7 +129,7 @@ class ApiControllerTest extends TestCase { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) - ->will($this->throwException(new StorageNotAvailableException('My error message'))); + ->willThrowException(new StorageNotAvailableException('My error message')); $expected = new DataResponse(['message' => 'My error message'], Http::STATUS_SERVICE_UNAVAILABLE); $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); @@ -140,7 +139,7 @@ class ApiControllerTest extends TestCase { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) - ->will($this->throwException(new \Exception('My error message'))); + ->willThrowException(new \Exception('My error message')); $expected = new DataResponse(['message' => 'My error message'], Http::STATUS_NOT_FOUND); $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); @@ -183,16 +182,10 @@ class ApiControllerTest extends TestCase { } public function testGetThumbnailSharedNoDownload(): void { - $attributes = $this->createMock(IAttributes::class); - $attributes->expects(self::once()) - ->method('getAttribute') - ->with('permissions', 'download') - ->willReturn(false); - $share = $this->createMock(IShare::class); $share->expects(self::once()) - ->method('getAttributes') - ->willReturn($attributes); + ->method('canSeeContent') + ->willReturn(false); $storage = $this->createMock(ISharedStorage::class); $storage->expects(self::once()) @@ -221,8 +214,8 @@ class ApiControllerTest extends TestCase { public function testGetThumbnailShared(): void { $share = $this->createMock(IShare::class); $share->expects(self::once()) - ->method('getAttributes') - ->willReturn(null); + ->method('canSeeContent') + ->willReturn(true); $storage = $this->createMock(ISharedStorage::class); $storage->expects(self::once()) diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 93ef98bdec7..a9a80fc6f35 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -210,9 +210,7 @@ class ViewControllerTest extends TestCase { ]; } - /** - * @dataProvider dataTestShortRedirect - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShortRedirect')] public function testShortRedirect(?string $openfile, ?string $opendetails, string $result): void { $this->appManager->expects($this->any()) ->method('isEnabledForUser') |