LocationBundleExtensionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaultConfig() 0 15 1
A getContainer() 0 10 1
1
<?php
2
3
namespace AlexeyKuperhstokh\LocationBundle\Tests\DependencyInjection;
4
5
use AlexeyKuperhstokh\LocationBundle\DependencyInjection\LocationBundleExtension;
6
use GuzzleHttp\Psr7\Request;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
class LocationBundleExtensionTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testDefaultConfig()
12
    {
13
        $configs = array();
14
15
        $container = $this->getContainer($configs);
16
17
        // check location and request
18
        $this->assertInstanceOf('GuzzleHttp\Psr7\Uri', $container->get('location_bundle.uri'));
19
        $this->assertInstanceOf('GuzzleHttp\Psr7\Request', $container->get('location_bundle.request'));
20
        $this->assertInstanceOf('GuzzleHttp\Client', $container->get('location_bundle.http_client'));
21
        $this->assertInstanceOf(
22
            'AlexeyKuperhstokh\LocationBundle\Client\Client',
23
            $container->get('location_bundle.client')
24
        );
25
    }
26
27
    /**
28
     * @param array $config
29
     * @return ContainerBuilder
30
     */
31
    protected function getContainer(array $config = array())
32
    {
33
        $container = new ContainerBuilder();
34
        $container->getCompilerPassConfig()->setOptimizationPasses(array());
35
        $container->getCompilerPassConfig()->setRemovingPasses(array());
36
        $loader = new LocationBundleExtension();
37
        $loader->load($config, $container);
38
        $container->compile();
39
        return $container;
40
    }
41
}
42