testLoadSetParameters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Beelab\SimplePageBundle\Tests\DependencyInjection;
4
5
use Beelab\SimplePageBundle\DependencyInjection\BeelabSimplePageExtension;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
/**
10
 * @group unit
11
 */
12
final class BeelabSimplePageExtensionTest extends TestCase
13
{
14
    public function testLoadSetParameters(): void
15
    {
16
        /**
17
         * @var ContainerBuilder&\PHPUnit\Framework\MockObject\MockObject
18
         */
19
        $container = $this->getMockBuilder(ContainerBuilder::class)->disableOriginalConstructor()->getMock();
20
21
        $container->expects($this->exactly(3))->method('setParameter');
22
23
        $extension = new BeelabSimplePageExtension();
24
        $configs = [
25
            ['page_class' => 'foo'],
26
            ['resources_prefix' => 'BarBundle:Dir:'],
27
        ];
28
        $extension->load($configs, $container);
0 ignored issues
show
Documentation introduced by
$container is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...ction\ContainerBuilder>.

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);
Loading history...
29
    }
30
}
31