Completed
Push — master ( 64f98e...11f175 )
by Jimmy
03:19 queued 01:21
created

MailRecorder::beforeSendPerformed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Spinen\MailAssertions;
4
5
use PHPUnit_Framework_TestCase;
6
use Swift_Events_EventListener;
7
use Swift_Events_SendEvent;
8
9
/**
10
 * Class MailRecorder
11
 *
12
 * @package Spinen\MailAssertions
13
 */
14
class MailRecorder implements Swift_Events_EventListener
15
{
16
    /**
17
     * @var PHPUnit_Framework_TestCase
18
     */
19
    protected $test;
20
21
    /**
22
     * MailRecorder constructor.
23
     *
24
     * @param PHPUnit_Framework_TestCase $test
25
     */
26
    public function __construct(PHPUnit_Framework_TestCase $test)
27
    {
28
        $this->test = $test;
29
    }
30
31
    /**
32
     * Called by Laravel before email is given to the transporter.
33
     *
34
     * Passes the email to the test, so that assertions can be ran against the messages.
35
     *
36
     * @param Swift_Events_SendEvent $event
37
     */
38
    public function beforeSendPerformed(Swift_Events_SendEvent $event)
39
    {
40
        $this->test->recordMail($event->getMessage());
0 ignored issues
show
Bug introduced by
The method recordMail() does not seem to exist on object<PHPUnit_Framework_TestCase>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
    }
42
}
43