BeelabPaypalExtensionTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testLoadSetParameters() 0 19 1
1
<?php
2
3
namespace Beelab\PaypalBundle\Tests\DependencyInjection;
4
5
use Beelab\PaypalBundle\DependencyInjection\BeelabPaypalExtension;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
9
10
class BeelabPaypalExtensionTest extends TestCase
11
{
12
    public function testLoadSetParameters(): void
13
    {
14
        $container = $this->getMockBuilder(ContainerBuilder::class)->disableOriginalConstructor()->getMock();
15
        $parameterBag = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
16
17
        $parameterBag->expects($this->any())->method('add');
18
        $container->expects($this->any())->method('getParameterBag')->willReturn($parameterBag);
19
20
        $extension = new BeelabPaypalExtension();
21
        $configs = [
22
            ['username' => 'a'],
23
            ['password' => 'b'],
24
            ['signature' => 'c'],
25
            ['return_route' => 'pippo'],
26
            ['cancel_route' => 'pluto'],
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
        $this->assertTrue(true);
30
    }
31
}
32