0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-07 18:09:45 +00:00
nextcloud_server/tests/lib/Mail/Provider/AttachmentTest.php
SebastianKrupinski fc0b694d37 feat: mail provider backend
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
2024-07-23 16:20:36 -04:00

71 lines
1.7 KiB
PHP

<?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\Attachment;
use Test\TestCase;
class AttachmentTest extends TestCase {
/** @var Attachment&MockObject */
private Attachment $attachment;
protected function setUp(): void {
parent::setUp();
$this->attachment = new Attachment(
'This is the contents of a file',
'example1.txt',
'text/plain',
false
);
}
public function testName(): void {
// test set by constructor
$this->assertEquals('example1.txt', $this->attachment->getName());
// test set by setter
$this->attachment->setName('example2.txt');
$this->assertEquals('example2.txt', $this->attachment->getName());
}
public function testType(): void {
// test set by constructor
$this->assertEquals('text/plain', $this->attachment->getType());
// test set by setter
$this->attachment->setType('text/html');
$this->assertEquals('text/html', $this->attachment->getType());
}
public function testContents(): void {
// test set by constructor
$this->assertEquals('This is the contents of a file', $this->attachment->getContents());
// test set by setter
$this->attachment->setContents('This is the modified contents of a file');
$this->assertEquals('This is the modified contents of a file', $this->attachment->getContents());
}
public function testEmbedded(): void {
// test set by constructor
$this->assertEquals(false, $this->attachment->getEmbedded());
// test set by setter
$this->attachment->setEmbedded(true);
$this->assertEquals(true, $this->attachment->getEmbedded());
}
}