Completed
Push — master ( 1b2caf...477fa6 )
by Christian
06:34
created

Core23SitemapBundleTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testItIsInstantiable() 0 6 1
A testBuild() 0 11 1
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SitemapBundle\Tests;
11
12
use Core23\SitemapBundle\Core23SitemapBundle;
13
use Core23\SitemapBundle\DependencyInjection\Compiler\SitemapCompilerPass;
14
use PHPUnit\Framework\TestCase;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
class Core23SitemapBundleTest extends TestCase
18
{
19
    public function testItIsInstantiable(): void
20
    {
21
        $bundle = new Core23SitemapBundle();
22
23
        $this->assertInstanceOf(Core23SitemapBundle::class, $bundle);
24
    }
25
26
    public function testBuild(): void
27
    {
28
        $containerBuilder = $this->createMock(ContainerBuilder::class);
29
30
        $containerBuilder->expects($this->once())->method('addCompilerPass')
31
            ->with($this->isInstanceOf(SitemapCompilerPass::class))
32
        ;
33
34
        $bundle = new Core23SitemapBundle();
35
        $bundle->build($containerBuilder);
0 ignored issues
show
Documentation introduced by core23
$containerBuilder 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...
36
    }
37
}
38