1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use kalanis\EmailApi\Basics\Attachment; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class AttachmentTest extends CommonTestClass |
7
|
|
|
{ |
8
|
|
|
public function testSimple() |
9
|
|
|
{ |
10
|
|
|
$data = $this->mockAttachment(); |
11
|
|
|
$this->assertEquals('testing_file', $data->name); |
12
|
|
|
$this->assertEquals('', $data->path); |
13
|
|
|
$this->assertEquals('text/plain', $data->mime); |
14
|
|
|
$this->assertEquals('qwertzuiopasdfghjklyxcvbnm', $data->content); |
15
|
|
|
$this->assertEquals('utf8', $data->encoding); |
16
|
|
|
$this->assertEquals(Attachment::TYPE_INLINE, $data->type); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function testOutputs() |
20
|
|
|
{ |
21
|
|
|
$data = $this->mockAttachment(); |
22
|
|
|
$this->assertEquals('testing_file', $data->getFileName()); |
23
|
|
|
$this->assertEquals('', $data->getLocalPath()); |
24
|
|
|
$this->assertEquals('text/plain', $data->getFileMime()); |
25
|
|
|
$this->assertEquals('qwertzuiopasdfghjklyxcvbnm', $data->getFileContent()); |
26
|
|
|
$this->assertEquals('utf8', $data->getEncoding()); |
27
|
|
|
$this->assertEquals(Attachment::TYPE_INLINE, $data->getType()); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function testSanitize() |
31
|
|
|
{ |
32
|
|
|
$data = $this->mockAttachment(); |
33
|
|
|
$data->type = '3'; |
34
|
|
|
$data->path = 'null'; |
35
|
|
|
$data->sanitize(); |
36
|
|
|
$this->assertEquals('null', $data->path); |
37
|
|
|
$this->assertEquals(Attachment::TYPE_IMAGE, $data->type); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|