This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 Hautzi\SystemMailBundle\Tests\SystemMailer; |
||
4 | |||
5 | |||
6 | use Hautzi\SystemMailBundle\SystemMailer\MailDefinition\ParserInterface; |
||
7 | use Hautzi\SystemMailBundle\SystemMailer\MailDefinition\ProviderInterface; |
||
8 | use Hautzi\SystemMailBundle\SystemMailer\Mailer\MailerInterface; |
||
9 | use Hautzi\SystemMailBundle\SystemMailer\ParsedMessage; |
||
10 | use Hautzi\SystemMailBundle\SystemMailer\SystemMailer; |
||
11 | |||
12 | class SystemMailerTest extends \PHPUnit_Framework_TestCase |
||
13 | { |
||
14 | protected $fixture; |
||
15 | |||
16 | /** |
||
17 | * @var ProviderInterface |
||
18 | */ |
||
19 | protected $provider; |
||
20 | /** |
||
21 | * @var ParserInterface |
||
22 | */ |
||
23 | protected $parser; |
||
24 | /** |
||
25 | * @var MailerInterface |
||
26 | */ |
||
27 | protected $mailer; |
||
28 | |||
29 | |||
30 | public function testSendWithoutDefaults() |
||
31 | { |
||
32 | $fixture = $this->createFixture('de'); |
||
33 | |||
34 | $parsedMessage = $this->prophesize(ParsedMessage::class)->reveal(); |
||
35 | |||
36 | $this->provider->fetchMailDefinition('App:test', ['param1' => 'yay!'])->willReturn('<email></email>')->shouldBeCalled(); |
||
0 ignored issues
–
show
|
|||
37 | $this->parser->parseMailDefinition('<email></email>', 'de')->willReturn($parsedMessage)->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
willReturn() does not seem to exist on object<Hautzi\SystemMail...emMailer\ParsedMessage> .
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. ![]() |
|||
38 | $this->mailer->send($parsedMessage, null)->shouldBeCalled(); |
||
39 | |||
40 | $fixture->send('App:test', ['param1' => 'yay!']); |
||
41 | } |
||
42 | |||
43 | |||
44 | public function testSendDefaultsArePopulated() |
||
45 | { |
||
46 | $fixture = $this->createFixture('de', [ |
||
47 | 'subject' => '_1', |
||
48 | 'replyTo' => '_2', |
||
49 | 'from' => [ |
||
50 | 'email' => '_3', |
||
51 | 'name' => '_4', |
||
52 | ], |
||
53 | 'to' => [ |
||
54 | 'email' => '_5', |
||
55 | 'name' => '_6', |
||
56 | ], |
||
57 | 'cc' => [ |
||
58 | 'email' => '_7', |
||
59 | 'name' => '_8', |
||
60 | ], |
||
61 | 'bcc' => [ |
||
62 | 'email' => '_9', |
||
63 | 'name' => '_10', |
||
64 | ] |
||
65 | ]); |
||
66 | |||
67 | $parsedMessage = $this->prophesize(ParsedMessage::class); |
||
68 | $parsedMessage->getSubject()->willReturn(null); |
||
69 | $parsedMessage->setSubject('_1')->shouldBeCalled(); |
||
70 | $parsedMessage->getReplyTo()->willReturn(null); |
||
71 | $parsedMessage->setReplyTo('_2')->shouldBeCalled(); |
||
72 | $parsedMessage->getFrom()->willReturn([]); |
||
73 | $parsedMessage->setFrom('_3', '_4')->shouldBeCalled(); |
||
74 | $parsedMessage->getTo()->willReturn([]); |
||
75 | $parsedMessage->addTo('_5', '_6')->shouldBeCalled(); |
||
76 | $parsedMessage->getCc()->willReturn([]); |
||
77 | $parsedMessage->addCc('_7', '_8')->shouldBeCalled(); |
||
78 | $parsedMessage->getBcc()->willReturn([]); |
||
79 | $parsedMessage->addBcc('_9', '_10')->shouldBeCalled(); |
||
80 | |||
81 | $this->provider->fetchMailDefinition('App:test', ['param1' => 'yay!'])->willReturn('<email></email>')->shouldBeCalled(); |
||
0 ignored issues
–
show
|
|||
82 | $this->parser->parseMailDefinition('<email></email>', 'de')->willReturn($parsedMessage)->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
willReturn() does not seem to exist on object<Hautzi\SystemMail...emMailer\ParsedMessage> .
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. ![]() |
|||
83 | $this->mailer->send($parsedMessage, null)->shouldBeCalled(); |
||
0 ignored issues
–
show
$parsedMessage is of type object<Prophecy\Prophecy\ObjectProphecy> , but the function expects a object<Hautzi\SystemMail...emMailer\ParsedMessage> .
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);
![]() |
|||
84 | |||
85 | $fixture->send('App:test', ['param1' => 'yay!']); |
||
86 | } |
||
87 | |||
88 | |||
89 | /** |
||
90 | * @param null $locale |
||
91 | * @param array $defaults |
||
92 | * |
||
93 | * @return SystemMailer |
||
94 | */ |
||
95 | protected function createFixture($locale = null, $defaults = []) |
||
96 | { |
||
97 | $this->provider = $this->prophesize(ProviderInterface::class); |
||
0 ignored issues
–
show
It seems like
$this->prophesize(\Hautz...oviderInterface::class) of type object<Prophecy\Prophecy\ObjectProphecy> is incompatible with the declared type object<Hautzi\SystemMail...tion\ProviderInterface> of property $provider .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
98 | $this->parser = $this->prophesize(ParserInterface::class); |
||
0 ignored issues
–
show
It seems like
$this->prophesize(\Hautz...ParserInterface::class) of type object<Prophecy\Prophecy\ObjectProphecy> is incompatible with the declared type object<Hautzi\SystemMail...nition\ParserInterface> of property $parser .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
99 | $this->mailer = $this->prophesize(MailerInterface::class); |
||
0 ignored issues
–
show
It seems like
$this->prophesize(\Hautz...MailerInterface::class) of type object<Prophecy\Prophecy\ObjectProphecy> is incompatible with the declared type object<Hautzi\SystemMail...Mailer\MailerInterface> of property $mailer .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
100 | |||
101 | $defaults = $this->mergeDefaults($defaults); |
||
102 | |||
103 | return new SystemMailer($this->provider->reveal(), $this->parser->reveal(), $this->mailer->reveal(), $locale, $defaults); |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * @param array $defaults |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | protected function mergeDefaults(array $defaults = []) |
||
112 | { |
||
113 | return array_replace_recursive([ |
||
114 | 'subject' => '', |
||
115 | 'replyTo' => '', |
||
116 | 'from' => [ |
||
117 | 'email' => '', |
||
118 | 'name' => '', |
||
119 | ], |
||
120 | 'to' => [ |
||
121 | 'email' => '', |
||
122 | 'name' => '', |
||
123 | ], |
||
124 | 'cc' => [ |
||
125 | 'email' => '', |
||
126 | 'name' => '', |
||
127 | ], |
||
128 | 'bcc' => [ |
||
129 | 'email' => '', |
||
130 | 'name' => '', |
||
131 | ], |
||
132 | ], $defaults); |
||
133 | } |
||
134 | } |
||
135 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.