AttachmentTest::testOutputs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 10
c 1
b 0
f 0
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