Skip to content

Commit

Permalink
fixup! feat: apply personal out-of-office data to the auto responder
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Nov 21, 2023
1 parent 303a9f6 commit 75fd9e7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/Unit/Controller/OutOfOfficeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
}

Expand All @@ -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);
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 75fd9e7

Please sign in to comment.