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

FormMailerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSendContactMail() 0 20 1
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