aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/tests/ImageManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests/ImageManagerTest.php')
-rw-r--r--apps/theming/tests/ImageManagerTest.php42
1 files changed, 16 insertions, 26 deletions
diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php
index 68c8a06ee2f..0c4d555cc00 100644
--- a/apps/theming/tests/ImageManagerTest.php
+++ b/apps/theming/tests/ImageManagerTest.php
@@ -1,4 +1,6 @@
<?php
+
+declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -20,24 +22,14 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class ImageManagerTest extends TestCase {
- /** @var IConfig|MockObject */
- protected $config;
- /** @var IAppData|MockObject */
- protected $appData;
- /** @var ImageManager */
- protected $imageManager;
- /** @var IURLGenerator|MockObject */
- private $urlGenerator;
- /** @var ICacheFactory|MockObject */
- private $cacheFactory;
- /** @var LoggerInterface|MockObject */
- private $logger;
- /** @var ITempManager|MockObject */
- private $tempManager;
- /** @var ISimpleFolder|MockObject */
- private $rootFolder;
- /** @var BackgroundService|MockObject */
- private $backgroundService;
+ protected IConfig&MockObject $config;
+ protected IAppData&MockObject $appData;
+ private IURLGenerator&MockObject $urlGenerator;
+ private ICacheFactory&MockObject $cacheFactory;
+ private LoggerInterface&MockObject $logger;
+ private ITempManager&MockObject $tempManager;
+ private ISimpleFolder&MockObject $rootFolder;
+ protected ImageManager $imageManager;
protected function setUp(): void {
parent::setUp();
@@ -48,7 +40,7 @@ class ImageManagerTest extends TestCase {
$this->logger = $this->createMock(LoggerInterface::class);
$this->tempManager = $this->createMock(ITempManager::class);
$this->rootFolder = $this->createMock(ISimpleFolder::class);
- $this->backgroundService = $this->createMock(BackgroundService::class);
+ $backgroundService = $this->createMock(BackgroundService::class);
$this->imageManager = new ImageManager(
$this->config,
$this->appData,
@@ -56,7 +48,7 @@ class ImageManagerTest extends TestCase {
$this->cacheFactory,
$this->logger,
$this->tempManager,
- $this->backgroundService,
+ $backgroundService,
);
$this->appData
->expects($this->any())
@@ -229,7 +221,7 @@ class ImageManagerTest extends TestCase {
$folder->expects($this->once())
->method('getFile')
->with('filename')
- ->will($this->throwException(new NotFoundException()));
+ ->willThrowException(new NotFoundException());
$image = $this->imageManager->getCachedImage('filename');
}
@@ -309,7 +301,7 @@ class ImageManagerTest extends TestCase {
}
- public function dataUpdateImage() {
+ public static function dataUpdateImage(): array {
return [
['background', __DIR__ . '/../../../tests/data/testimage.png', true, false],
['background', __DIR__ . '/../../../tests/data/testimage.png', false, false],
@@ -321,10 +313,8 @@ class ImageManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataUpdateImage
- */
- public function testUpdateImage($key, $tmpFile, $folderExists, $shouldConvert): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateImage')]
+ public function testUpdateImage(string $key, string $tmpFile, bool $folderExists, bool $shouldConvert): void {
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
$oldFile = $this->createMock(ISimpleFile::class);