RestTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 14
dl 0
loc 30
rs 10
c 2
b 0
f 1
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testInternalDies() 0 7 1
A testExcept() 0 4 1
A testLocalProcessing() 0 5 1
A testInternal() 0 5 1
1
<?php
2
3
use kalanis\EmailApi\Exceptions;
4
use kalanis\EmailApi\LocalInfo;
5
use kalanis\EmailApi\Services;
6
7
8
class RestTest extends CommonTestClass
9
{
10
    public function testExcept()
11
    {
12
        $ex = new Exceptions\EmailException('something');
13
        $this->assertEquals('something', $ex->getMessage());
14
    }
15
16
    public function testInternal()
17
    {
18
        $lib = new Services\Internal();
19
        $this->assertTrue($lib->canUseService());
20
        $this->assertEquals(1, $lib->systemServiceId());
21
        // more is not possible - here is direct system call for email
22
    }
23
24
    public function testInternalDies()
25
    {
26
        $data = $this->mockContent();
27
        $data->addAttachment($this->mockAttachment());
28
        $lib = new Services\Internal();
29
        $result = $lib->sendEmail($data, $this->mockUser());
30
        $this->assertFalse($result->getStatus());
31
    }
32
33
    public function testLocalProcessing()
34
    {
35
        $lib = new LocalInfo\LocalProcessing(); // necessary in subservices
36
        $lib->enableMailLocally($this->mockUser());
37
        $this->assertTrue(true); // because coverage sniffing
38
    }
39
}
40