diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-31 15:34:57 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-05-02 10:52:43 +0200 |
commit | e2531f8503dea904dd1cb389ca017ce7bda5ccfc (patch) | |
tree | 683918ba234959dd76e771aaae2af434b21d09fe /apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php | |
parent | 49b650c4a46c76121d74c6c37c0dbfa0d8f53dbe (diff) | |
download | nextcloud-server-e2531f8503dea904dd1cb389ca017ce7bda5ccfc.tar.gz nextcloud-server-e2531f8503dea904dd1cb389ca017ce7bda5ccfc.zip |
Migrate dav application from ILogger to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php index 62480f5c017..6bd1f6b3206 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php @@ -34,8 +34,8 @@ use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; use OCP\Http\Client\LocalServerException; use OCP\IConfig; -use OCP\ILogger; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\BadRequest; use Sabre\VObject; use Sabre\VObject\Recur\NoInstancesException; @@ -53,7 +53,7 @@ class RefreshWebcalServiceTest extends TestCase { /** @var IConfig | MockObject */ private $config; - /** @var ILogger | MockObject */ + /** @var LoggerInterface | MockObject */ private $logger; protected function setUp(): void { @@ -62,7 +62,7 @@ class RefreshWebcalServiceTest extends TestCase { $this->caldavBackend = $this->createMock(CalDavBackend::class); $this->clientService = $this->createMock(IClientService::class); $this->config = $this->createMock(IConfig::class); - $this->logger = $this->createMock(ILogger::class); + $this->logger = $this->createMock(LoggerInterface::class); } /** @@ -144,7 +144,7 @@ class RefreshWebcalServiceTest extends TestCase { $refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123'); } - + /** * @param string $body * @param string $contentType @@ -209,15 +209,15 @@ class RefreshWebcalServiceTest extends TestCase { $this->caldavBackend->expects($this->once()) ->method('createCalendarObject') ->with(42, 'uri-1.ics', $result, 1); - + $noInstanceException = new NoInstancesException("can't add calendar object"); $this->caldavBackend->expects($this->once()) ->method("createCalendarObject") ->willThrowException($noInstanceException); - + $this->logger->expects($this->once()) - ->method('logException') - ->with($noInstanceException); + ->method('error') + ->with($noInstanceException->getMessage(), ['exception' => $noInstanceException]); $refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123'); } @@ -286,15 +286,15 @@ class RefreshWebcalServiceTest extends TestCase { $this->caldavBackend->expects($this->once()) ->method('createCalendarObject') ->with(42, 'uri-1.ics', $result, 1); - + $badRequestException = new BadRequest("can't add reach calendar url"); $this->caldavBackend->expects($this->once()) ->method("createCalendarObject") ->willThrowException($badRequestException); - + $this->logger->expects($this->once()) - ->method('logException') - ->with($badRequestException); + ->method('error') + ->with($badRequestException->getMessage(), ['exception' => $badRequestException]); $refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123'); } @@ -361,13 +361,14 @@ class RefreshWebcalServiceTest extends TestCase { ->with('dav', 'webcalAllowLocalAccess', 'no') ->willReturn('no'); + $exception = new LocalServerException(); $client->expects($this->once()) ->method('get') - ->willThrowException(new LocalServerException()); + ->willThrowException($exception); $this->logger->expects($this->once()) - ->method('logException') - ->with($this->isInstanceOf(LocalServerException::class), $this->anything()); + ->method('warning') + ->with($this->anything(), ['exception' => $exception]); $refreshWebcalService->refreshSubscription('principals/users/testuser', 'sub123'); } |