Conditions | 1 |
Paths | 1 |
Total Lines | 33 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function testLoadFromEntityWithSamePropertyValues(): void |
||
31 | { |
||
32 | $fooA = new Foo(); |
||
33 | $fooA->setBar(1); |
||
34 | $fooA->setBaz('baz'); |
||
35 | |||
36 | $fooB = new Foo(); |
||
37 | $fooB->setBar(2); |
||
38 | $fooB->setBaz('baz'); |
||
39 | |||
40 | $this->modelManager->expects($this->once()) |
||
41 | ->method('findBy') |
||
42 | ->will($this->returnValue([$fooA, $fooB])); |
||
43 | |||
44 | $this->modelManager->expects($this->any()) |
||
45 | ->method('getIdentifierValues') |
||
46 | ->will($this->returnCallback(function (Foo $foo) { |
||
47 | return [$foo->getBar()]; |
||
48 | })); |
||
49 | |||
50 | $modelChoiceLoader = new ModelChoiceLoader( |
||
51 | $this->modelManager, |
||
|
|||
52 | \Sonata\AdminBundle\Tests\Fixtures\Entity\Foo::class, |
||
53 | 'baz' |
||
54 | ); |
||
55 | |||
56 | $expectedChoices = [ |
||
57 | 1 => 'baz (id: 1)', |
||
58 | 2 => 'baz (id: 2)', |
||
59 | ]; |
||
60 | |||
61 | $this->assertSame($expectedChoices, $modelChoiceLoader->loadChoiceList()->getOriginalKeys()); |
||
62 | } |
||
63 | } |
||
64 |
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: