Completed
Push — master ( 4c839e...4fda94 )
by Ruud
12:51 queued 10s
created

FormBundle/Tests/unit/Helper/FormMailerTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\FormBundle\Tests\Helper;
4
5
use Kunstmaan\FormBundle\Entity\FormSubmission;
6
use Kunstmaan\FormBundle\Helper\FormMailer;
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\RequestStack;
11
use Symfony\Component\Templating\DelegatingEngine;
12
13
class FormMailerTest extends TestCase
14
{
15
    public function testSendContactMail()
16
    {
17
        /** @var \Swift_Mailer $mailer */
18
        $mailer = $this->createMock(\Swift_Mailer::class);
19
        /** @var DelegatingEngine $twigEngine */
20
        $twigEngine = $this->createMock(DelegatingEngine::class);
21
        /** @var ContainerInterface $container */
22
        $container = $this->createMock(ContainerInterface::class);
23
        $request = $this->createMock(Request::class);
24
        $requestStack = $this->createMock(RequestStack::class);
25
26
        $mailer->expects($this->once())->method('send');
0 ignored issues
show
The method expects() does not seem to exist on object<Swift_Mailer>.

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...
27
        $request->expects($this->once())->method('getScheme')->willReturn('http');
28
        $request->expects($this->once())->method('getHttpHost')->willReturn('example.com');
29
        $requestStack->expects($this->once())->method('getCurrentRequest')->willReturn($request);
30
        $container->expects($this->once())->method('get')->willReturn($requestStack);
0 ignored issues
show
The method expects() does not seem to exist on object<Symfony\Component...ion\ContainerInterface>.

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...
31
32
        $formMailer = new FormMailer($mailer, $twigEngine, $container);
33
34
        /** @var FormSubmission $formSubmission */
35
        $formSubmission = $this->createMock(FormSubmission::class);
36
37
        $formMailer->sendContactMail($formSubmission, '[email protected]', '[email protected]', 'subject');
38
    }
39
}
40