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

MailEventTest::testMailResultInjection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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