From 75fd9e78ff7f7a3d654cb68e44e04951e338c621 Mon Sep 17 00:00:00 2001 From: Richard Steinmetz Date: Wed, 22 Nov 2023 00:34:24 +0100 Subject: [PATCH] fixup! feat: apply personal out-of-office data to the auto responder --- tests/Unit/Controller/OutOfOfficeControllerTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Controller/OutOfOfficeControllerTest.php b/tests/Unit/Controller/OutOfOfficeControllerTest.php index 24baeec7ff..0bbd5ba57e 100644 --- a/tests/Unit/Controller/OutOfOfficeControllerTest.php +++ b/tests/Unit/Controller/OutOfOfficeControllerTest.php @@ -29,7 +29,6 @@ use ChristophWurst\Nextcloud\Testing\ServiceMockObject; use ChristophWurst\Nextcloud\Testing\TestCase; use DateTimeImmutable; -use OC\User\OutOfOfficeData; use OCA\Mail\Account; use OCA\Mail\Controller\OutOfOfficeController; use OCA\Mail\Db\MailAccount; @@ -53,7 +52,8 @@ class OutOfOfficeControllerTest extends TestCase { protected function setUp(): void { parent::setUp(); - if (!interface_exists(IAvailabilityCoordinator::class)) { + if (!interface_exists(IAvailabilityCoordinator::class) + || !interface_exists(IOutOfOfficeData::class)) { $this->markTestSkipped('Out-of-office feature is not available'); } @@ -79,7 +79,11 @@ private function createOutOfOfficeData( int $endDate, string $subject, string $message, - ): IOutOfOfficeData { + ): ?IOutOfOfficeData { + if (!interface_exists(IOutOfOfficeData::class)) { + return null; + } + $data = $this->createMock(IOutOfOfficeData::class); $data->method('getId')->willReturn($id); $data->method('getUser')->willReturn($user); @@ -152,7 +156,7 @@ public function enabledOutOfOfficeDataProvider(): array { /** * @dataProvider enabledOutOfOfficeDataProvider */ - public function testFollowSystemWithEnabledOutOfOffice(IOutOfOfficeData $data): void { + public function testFollowSystemWithEnabledOutOfOffice(?IOutOfOfficeData $data): void { $startDate = $data->getStartDate(); $endDate = $data->getEndDate();