AddressTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Mail\Provider;
  8. use OCP\Mail\Provider\Address;
  9. use Test\TestCase;
  10. class AddressTest extends TestCase {
  11. /** @var Address&MockObject */
  12. private Address $address;
  13. protected function setUp(): void {
  14. parent::setUp();
  15. $this->address = new Address('user1@testing.com', 'User One');
  16. }
  17. public function testAddress(): void {
  18. // test set by constructor
  19. $this->assertEquals('user1@testing.com', $this->address->getAddress());
  20. // test set by setter
  21. $this->address->setAddress('user2@testing.com');
  22. $this->assertEquals('user2@testing.com', $this->address->getAddress());
  23. }
  24. public function testLabel(): void {
  25. // test set by constructor
  26. $this->assertEquals('User One', $this->address->getLabel());
  27. // test set by setter
  28. $this->address->setLabel('User Two');
  29. $this->assertEquals('User Two', $this->address->getLabel());
  30. }
  31. }