AttachmentTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 21
dl 0
loc 32
rs 10
c 2
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testOutputs() 0 9 1
A testSimple() 0 9 1
A testSanitize() 0 8 1
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