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\Bundle\TwigBundle\TwigEngine; |
||
9 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
10 | use Symfony\Component\HttpFoundation\Request; |
||
11 | use Symfony\Component\HttpFoundation\RequestStack; |
||
12 | |||
13 | class FormMailerTest extends TestCase |
||
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); |
||
0 ignored issues
–
show
$twigEngine is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<Symfony\Bundle\TwigBundle\TwigEngine> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$container is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<Symfony\Component...ion\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
30 | |||
31 | $formSubmission = $this->createMock(FormSubmission::class); |
||
32 | |||
33 | $formMailer->sendContactMail($formSubmission, '[email protected]', '[email protected]', 'subject'); |
||
0 ignored issues
–
show
$formSubmission is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<Kunstmaan\FormBun...\Entity\FormSubmission> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
34 | } |
||
35 | } |
||
36 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: