AlgoliaSpecificationExtensionTest   A
last analyzed

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