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\AdminBundle\Tests\EventListener; |
||
4 | |||
5 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; |
||
6 | use Doctrine\ORM\Mapping\ClassMetadata; |
||
7 | use Kunstmaan\AdminBundle\Entity\AclChangeset; |
||
8 | use Kunstmaan\AdminBundle\EventListener\MappingListener; |
||
9 | use PHPUnit\Framework\TestCase; |
||
10 | |||
11 | class MappingListenerTest extends TestCase |
||
12 | { |
||
13 | public function testListener() |
||
14 | { |
||
15 | $args = $this->createMock(LoadClassMetadataEventArgs::class); |
||
16 | $meta = $this->createMock(ClassMetadata::class); |
||
17 | |||
18 | $meta->table = ['name' => 'test_table']; |
||
19 | |||
20 | $args->expects($this->once())->method('getClassMetadata')->willReturn($meta); |
||
21 | $meta->expects($this->once())->method('getName')->willReturn(AclChangeset::class); |
||
22 | $meta->expects($this->once())->method('mapManyToOne')->willReturn(AclChangeset::class); |
||
23 | $meta->expects($this->once())->method('mapManyToMany')->willReturn(AclChangeset::class); |
||
24 | |||
25 | $listener = new MappingListener(AclChangeset::class); |
||
26 | $listener->loadClassMetadata($args); |
||
0 ignored issues
–
show
|
|||
27 | } |
||
28 | } |
||
29 |
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: