Completed
Pull Request — master (#1)
by GBProd
04:20 queued 01:57
created

AlgoliaSpecificationExtensionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A testLoadHasServices() 0 10 1
A testLoadRegistry() 0 6 1
A testLoadHandler() 0 6 1
1
<?php
2
3
namespace Tests\GBProd\AlgoliaSpecificationBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use GBProd\AlgoliaSpecificationBundle\DependencyInjection\AlgoliaSpecificationExtension;
7
use GBProd\AlgoliaSpecification\Handler;
8
use GBProd\AlgoliaSpecification\Registry;
9
10
/**
11
 * Tests for AlgoliaSpecificationExtension
12
 *
13
 * @author gbprod <[email protected]>
14
 */
15
class AlgoliaSpecificationExtensionTest extends \PHPUnit_Framework_TestCase
16
{
17
    private $extension;
18
    private $container;
19
20
    protected function setUp()
21
    {
22
        $this->extension = new AlgoliaSpecificationExtension();
23
24
        $this->container = new ContainerBuilder();
25
        $this->container->registerExtension($this->extension);
26
27
        $this->container->loadFromExtension($this->extension->getAlias());
28
        $this->container->compile();
29
    }
30
31
    public function testLoadHasServices()
32
    {
33
        $this->assertTrue(
34
            $this->container->has('gbprod.algolia_specification_registry')
35
        );
36
37
        $this->assertTrue(
38
            $this->container->has('gbprod.algolia_specification_handler')
39
        );
40
    }
41
42
    public function testLoadRegistry()
43
    {
44
        $registry = $this->container->get('gbprod.algolia_specification_registry');
45
46
        $this->assertInstanceOf(Registry::class, $registry);
47
    }
48
49
    public function testLoadHandler()
50
    {
51
        $handler = $this->container->get('gbprod.algolia_specification_handler');
52
53
        $this->assertInstanceOf(Handler::class, $handler);
54
    }
55
}
56