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\PagePartBundle\Tests\Entity; |
||
4 | |||
5 | use Doctrine\ORM\EntityManager; |
||
6 | use Doctrine\ORM\EntityRepository; |
||
7 | use Kunstmaan\NodeBundle\Entity\AbstractPage; |
||
8 | use Kunstmaan\PagePartBundle\Entity\PageTemplateConfiguration; |
||
9 | use Kunstmaan\PagePartBundle\PageTemplate\PageTemplate; |
||
10 | use PHPUnit\Framework\TestCase; |
||
11 | |||
12 | /** |
||
13 | * Class LinkPagePartTest |
||
14 | */ |
||
15 | class PageTemplateConfigurationTest extends TestCase |
||
16 | { |
||
17 | public function testGetSet() |
||
18 | { |
||
19 | $config = new PageTemplateConfiguration(); |
||
20 | $config->setPageId(5); |
||
21 | $config->setPageEntityName(PageTemplate::class); |
||
22 | $config->setPageTemplate('string!'); |
||
23 | |||
24 | $this->assertEquals(5, $config->getPageId()); |
||
25 | $this->assertEquals(PageTemplate::class, $config->getPageEntityName()); |
||
26 | $this->assertEquals('string!', $config->getPageTemplate()); |
||
27 | |||
28 | $em = $this->getMockBuilder(EntityManager::class) |
||
29 | ->disableOriginalConstructor() |
||
30 | ->getMock(); |
||
31 | |||
32 | $repo = $this->getMockBuilder(EntityRepository::class) |
||
33 | ->disableOriginalConstructor() |
||
34 | ->getMock(); |
||
35 | |||
36 | $testNode = $this->createMock(AbstractPage::class); |
||
37 | |||
38 | $repo->expects($this->any()) |
||
39 | ->method('find') |
||
40 | ->willReturn($testNode); |
||
41 | |||
42 | $em->expects($this->any()) |
||
43 | ->method('getRepository') |
||
44 | ->willReturn($repo); |
||
45 | |||
46 | $this->assertInstanceOf(\get_class($testNode), $config->getPage($em)); |
||
0 ignored issues
–
show
|
|||
47 | } |
||
48 | } |
||
49 |
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: