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

MailListenerMock::onPreSend()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 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