1 | <?php |
||
9 | class BodyOptionsTest extends TestCase |
||
10 | { |
||
11 | /** |
||
12 | * @var BodyOptions |
||
13 | */ |
||
14 | private $bodyOptions; |
||
15 | |||
16 | public function setUp() |
||
20 | |||
21 | public function testDefaultValue() |
||
22 | { |
||
23 | $this->assertFalse($this->bodyOptions->getUseTemplate()); |
||
24 | $this->assertEquals('', $this->bodyOptions->getContent()); |
||
25 | $this->assertEquals(MailServiceInterface::DEFAULT_CHARSET, $this->bodyOptions->getCharset()); |
||
26 | $this->assertInstanceOf('AcMailer\Options\TemplateOptions', $this->bodyOptions->getTemplate()); |
||
27 | } |
||
28 | |||
29 | public function testSetCharset() |
||
30 | { |
||
31 | $expected = 'CP-1252'; |
||
32 | $this->assertSame($this->bodyOptions, $this->bodyOptions->setCharset($expected)); |
||
33 | $this->assertEquals($expected, $this->bodyOptions->getCharset()); |
||
34 | } |
||
35 | |||
36 | public function testSetTemplate() |
||
37 | { |
||
38 | $expected = new TemplateOptions(); |
||
39 | $this->assertSame($this->bodyOptions, $this->bodyOptions->setTemplate($expected)); |
||
40 | $this->assertSame($expected, $this->bodyOptions->getTemplate()); |
||
41 | |||
42 | $this->bodyOptions->setTemplate([]); |
||
43 | $this->assertInstanceOf('AcMailer\Options\TemplateOptions', $this->bodyOptions->getTemplate()); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @expectedException \AcMailer\Exception\InvalidArgumentException |
||
48 | */ |
||
49 | public function testSetTemplateWithInvalidValueThrowsException() |
||
53 | } |
||
54 |
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: