diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2023-09-21 15:12:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-21 15:12:31 +0200 |
commit | ff9de2efb6a1a755428bfb7b89d562c5fc46138d (patch) | |
tree | 17a3540a7eca420f91ea883dba0d50b012c4821f /apps/theming | |
parent | a1a1b990e62c046d17fe0a2f7991f102a93361c0 (diff) | |
parent | 0a9371f99f05786068d6f6a72b9a717ec24690a8 (diff) | |
download | nextcloud-server-ff9de2efb6a1a755428bfb7b89d562c5fc46138d.tar.gz nextcloud-server-ff9de2efb6a1a755428bfb7b89d562c5fc46138d.zip |
Merge pull request #40508 from nextcloud/fix/migrate-apps-away-from-ilogger
Migrate applications away from deprecated ILogger
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/lib/ImageManager.php | 35 | ||||
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 11 |
2 files changed, 14 insertions, 32 deletions
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index c987e7f4a9b..c577e099a96 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -42,38 +42,21 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\ILogger; use OCP\ITempManager; use OCP\IURLGenerator; +use Psr\Log\LoggerInterface; class ImageManager { public const SUPPORTED_IMAGE_KEYS = ['background', 'logo', 'logoheader', 'favicon']; - /** @var IConfig */ - private $config; - /** @var IAppData */ - private $appData; - /** @var IURLGenerator */ - private $urlGenerator; - /** @var ICacheFactory */ - private $cacheFactory; - /** @var ILogger */ - private $logger; - /** @var ITempManager */ - private $tempManager; - - public function __construct(IConfig $config, - IAppData $appData, - IURLGenerator $urlGenerator, - ICacheFactory $cacheFactory, - ILogger $logger, - ITempManager $tempManager) { - $this->config = $config; - $this->urlGenerator = $urlGenerator; - $this->cacheFactory = $cacheFactory; - $this->logger = $logger; - $this->tempManager = $tempManager; - $this->appData = $appData; + public function __construct( + private IConfig $config, + private IAppData $appData, + private IURLGenerator $urlGenerator, + private ICacheFactory $cacheFactory, + private LoggerInterface $logger, + private ITempManager $tempManager, + ) { } /** diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index e0e00615edb..8d42e892448 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -34,14 +34,13 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\ICacheFactory; use OCP\IConfig; -use OCP\ILogger; use OCP\ITempManager; use OCP\IURLGenerator; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; use Test\TestCase; class ImageManagerTest extends TestCase { - /** @var IConfig|MockObject */ protected $config; /** @var IAppData|MockObject */ @@ -52,7 +51,7 @@ class ImageManagerTest extends TestCase { private $urlGenerator; /** @var ICacheFactory|MockObject */ private $cacheFactory; - /** @var ILogger|MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; /** @var ITempManager|MockObject */ private $tempManager; @@ -65,7 +64,7 @@ class ImageManagerTest extends TestCase { $this->appData = $this->createMock(IAppData::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->cacheFactory = $this->createMock(ICacheFactory::class); - $this->logger = $this->createMock(ILogger::class); + $this->logger = $this->createMock(LoggerInterface::class); $this->tempManager = $this->createMock(ITempManager::class); $this->rootFolder = $this->createMock(ISimpleFolder::class); $this->imageManager = new ImageManager( @@ -143,7 +142,7 @@ class ImageManagerTest extends TestCase { ->withConsecutive( ['theming', 'cachebuster', '0'], ['theming', 'logoMime', ''] - ) + ) ->willReturn(0); $this->urlGenerator->expects($this->once()) ->method('linkToRoute') @@ -322,7 +321,7 @@ class ImageManagerTest extends TestCase { $folders[2]->expects($this->never())->method('delete'); $this->config->expects($this->once()) ->method('getAppValue') - ->with('theming','cachebuster','0') + ->with('theming', 'cachebuster', '0') ->willReturn('2'); $this->rootFolder->expects($this->once()) ->method('getDirectoryListing') |