aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Mail/Provider/AddressTest.php
blob: ee03f6f1e83c45806578c08ef3c75964d792eb7c (plain)
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
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace Test\Mail\Provider;

use OCP\Mail\Provider\Address;
use Test\TestCase;

class AddressTest extends TestCase {

	/** @var Address&MockObject */
	private Address $address;

	protected function setUp(): void {
		parent::setUp();

		$this->address = new Address('user1@testing.com', 'User One');

	}

	public function testAddress(): void {
		
		// test set by constructor
		$this->assertEquals('user1@testing.com', $this->address->getAddress());
		// test set by setter
		$this->address->setAddress('user2@testing.com');
		$this->assertEquals('user2@testing.com', $this->address->getAddress());

	}

	public function testLabel(): void {
		
		// test set by constructor
		$this->assertEquals('User One', $this->address->getLabel());
		// test set by setter
		$this->address->setLabel('User Two');
		$this->assertEquals('User Two', $this->address->getLabel());

	}

}