Completed
Push — develop ( f11aab...a4697b )
by Alejandro
09:31
created

MailEventTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 4
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMailResultInjection() 0 7 1
A testMailServiceInjection() 0 11 1
1
<?php
2
namespace AcMailerTest\Event;
3
4
use AcMailer\Event\MailEvent;
5
use AcMailer\Result\MailResult;
6
use AcMailer\Service\MailServiceMock;
7
use PHPUnit_Framework_TestCase as TestCase;
8
9
/**
10
 * Class MailEventTest
11
 * @author Alejandro Celaya Alastrué
12
 * @link http://www.alejandrocelaya.com
13
 */
14
class MailEventTest extends TestCase
15
{
16
    /**
17
     * @var MailEvent
18
     */
19
    private $mailEvent;
20
21
    public function testMailServiceInjection()
22
    {
23
        $mailService = new MailServiceMock();
24
        $this->mailEvent = new MailEvent($mailService);
25
        $this->assertSame($mailService, $this->mailEvent->getMailService());
26
27
        $mailService2 = new MailServiceMock();
28
        $this->mailEvent->setMailService($mailService2);
29
        $this->assertNotSame($mailService, $this->mailEvent->getMailService());
30
        $this->assertSame($mailService2, $this->mailEvent->getMailService());
31
    }
32
33
    public function testMailResultInjection()
34
    {
35
        $this->mailEvent = new MailEvent(new MailServiceMock());
36
        $result = new MailResult();
37
        $this->assertSame($this->mailEvent, $this->mailEvent->setResult($result));
38
        $this->assertSame($result, $this->mailEvent->getResult());
39
    }
40
}
41