-
Notifications
You must be signed in to change notification settings - Fork 316
Expand file tree
/
Copy pathDraftSavedEventTest.php
More file actions
51 lines (38 loc) · 1.53 KB
/
DraftSavedEventTest.php
File metadata and controls
51 lines (38 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Mail\Tests\Unit\Events;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCA\Mail\Account;
use OCA\Mail\Db\Message;
use OCA\Mail\Events\DraftSavedEvent;
use OCA\Mail\Model\NewMessageData;
class DraftSavedEventTest extends TestCase {
public function testConstructorWithAllParams(): void {
$account = $this->createStub(Account::class);
$newMessageData = $this->createStub(NewMessageData::class);
$draft = $this->createStub(Message::class);
$event = new DraftSavedEvent($account, $newMessageData, $draft);
$this->assertSame($account, $event->getAccount());
$this->assertSame($newMessageData, $event->getNewMessageData());
$this->assertSame($draft, $event->getDraft());
}
public function testConstructorWithoutOptionalParams(): void {
$account = $this->createStub(Account::class);
$event = new DraftSavedEvent($account);
$this->assertSame($account, $event->getAccount());
$this->assertNull($event->getNewMessageData());
$this->assertNull($event->getDraft());
}
public function testConstructorWithPartialParams(): void {
$account = $this->createStub(Account::class);
$newMessageData = $this->createStub(NewMessageData::class);
$event = new DraftSavedEvent($account, $newMessageData);
$this->assertSame($account, $event->getAccount());
$this->assertSame($newMessageData, $event->getNewMessageData());
$this->assertNull($event->getDraft());
}
}