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

MailListenerMock   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 58
c 0
b 0
f 0
wmc 6
lcom 3
cbo 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A onPreSend() 0 4 1
A onPostSend() 0 4 1
A onSendError() 0 4 1
A isOnPreSendCalled() 0 4 1
A isOnPostSendCalled() 0 4 1
A isOnSendErrorCalled() 0 4 1
1
<?php
2
namespace AcMailerTest\Event;
3
4
use AcMailer\Event\AbstractMailListener;
5
use AcMailer\Event\MailEvent;
6
7
/**
8
 * Class MailListenerMock
9
 * @author Alejandro Celaya Alastrué
10
 * @link http://www.alejandrocelaya.com
11
 */
12
class MailListenerMock extends AbstractMailListener
13
{
14
    private $onPreSendCalled    = false;
15
    private $onPostSendCalled   = false;
16
    private $onSendErrorCalled  = false;
17
18
    /**
19
     * Called before sending the email
20
     * @param MailEvent $e
21
     * @return mixed
22
     */
23
    public function onPreSend(MailEvent $e)
24
    {
25
        $this->onPreSendCalled = true;
26
    }
27
28
    /**
29
     * Called after sending the email
30
     * @param MailEvent $e
31
     * @return mixed
32
     */
33
    public function onPostSend(MailEvent $e)
34
    {
35
        $this->onPostSendCalled = true;
36
    }
37
38
    /**
39
     * Called if an error occurs while sending the email
40
     * @param MailEvent $e
41
     * @return mixed
42
     */
43
    public function onSendError(MailEvent $e)
44
    {
45
        $this->onSendErrorCalled = true;
46
    }
47
48
    /**
49
     * @return bool
50
     */
51
    public function isOnPreSendCalled()
52
    {
53
        return $this->onPreSendCalled;
54
    }
55
    /**
56
     * @return bool
57
     */
58
    public function isOnPostSendCalled()
59
    {
60
        return $this->onPostSendCalled;
61
    }
62
    /**
63
     * @return bool
64
     */
65
    public function isOnSendErrorCalled()
66
    {
67
        return $this->onSendErrorCalled;
68
    }
69
}
70