Completed
Push — l10n_master ( 9bc9d9...7bcb56 )
by Ruud
340:21 queued 321:33
created

FormMailerTest::testSendContactMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Kunstmaan\FormBundle\Tests\Helper;
4
5
use Kunstmaan\FormBundle\Entity\FormSubmission;
6
use Kunstmaan\FormBundle\Helper\FormMailer;
7
use Symfony\Bundle\TwigBundle\TwigEngine;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\RequestStack;
11
12
class FormMailerTest extends \PHPUnit_Framework_TestCase
13
{
14
15
    public function testSendContactMail()
16
    {
17
        $mailer = $this->createMock(\Swift_Mailer::class);
18
        $twigEngine = $this->createMock(TwigEngine::class);
19
        $container = $this->createMock(ContainerInterface::class);
20
        $request = $this->createMock(Request::class);
21
        $requestStack = $this->createMock(RequestStack::class);
22
23
        $mailer->expects($this->once())->method('send');
24
        $request->expects($this->once())->method('getScheme')->will($this->returnValue('http'));
25
        $request->expects($this->once())->method('getHttpHost')->will($this->returnValue('example.com'));
26
        $requestStack->expects($this->once())->method('getCurrentRequest')->will($this->returnValue($request));
27
        $container->expects($this->once())->method('get')->will($this->returnValue($requestStack));
28
29
        $formMailer = new FormMailer($mailer, $twigEngine, $container);
30
31
        $formSubmission = $this->createMock(FormSubmission::class);
32
33
        $formMailer->sendContactMail($formSubmission, '[email protected]', '[email protected]', 'subject');
34
    }
35
}
36