FrontRenderBundleTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testCompilerPassIsCalled() 0 6 1
1
<?php
2
3
namespace Chris\Bundle\FrontRenderBundle\Tests;
4
5
use Chris\Bundle\FrontRenderBundle\FrontRenderBundle;
6
use Phake;
7
use Phake_IMock;
8
use PHPUnit_Framework_TestCase;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
class FrontRenderBundleTest extends PHPUnit_Framework_TestCase
12
{
13
    /**
14
     * @var ContainerBuilder|Phake_IMock
15
     */
16
    protected $container;
17
18
    /**
19
     * @var FrontRenderBundle
20
     */
21
    protected $frontRenderBundle;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function setUp()
27
    {
28
        $this->container         = Phake::mock(ContainerBuilder::class);
29
        $this->frontRenderBundle = new FrontRenderBundle();
30
    }
31
32
    /**
33
     * Test if the the compiler pass is called
34
     */
35
    public function testCompilerPassIsCalled()
36
    {
37
        $this->frontRenderBundle->build($this->container);
0 ignored issues
show
Bug introduced by
It seems like $this->container can also be of type object<Phake_IMock>; however, Chris\Bundle\FrontRender...ntRenderBundle::build() does only seem to accept object<Symfony\Component...ction\ContainerBuilder>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
38
39
        Phake::verify($this->container)->addCompilerPass(Phake::anyParameters());
0 ignored issues
show
Bug introduced by
It seems like $this->container can also be of type object<Symfony\Component...ction\ContainerBuilder>; however, Phake::verify() does only seem to accept object<Phake_IMock>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
40
    }
41
}
42