BeelabSimplePageExtensionTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 19
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testLoadSetParameters() 0 16 1
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