ServiceContainerTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetContainer() 0 6 1
A testGetContainerReset() 0 6 1
A testCreate() 0 4 1
1
<?php
2
3
/**
4
 * Tests the service container.
5
 */
6
7
namespace Itafroma\Zork\Tests;
8
9
use Itafroma\Zork\ServiceContainer;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use \ReflectionClass;
12
13
class ServiceContainerTest extends ZorkTest
14
{
15
    /**
16
     * Tests Itafroma\Zork\ServiceContainer::getInstance().
17
     *
18
     * @covers Itafroma\Zork\ServiceContainer::getContainer
19
     */
20
    public function testGetContainer()
21
    {
22
        $container = ServiceContainer::getContainer();
23
24
        $this->assertEquals(spl_object_hash($container), spl_object_hash(ServiceContainer::getContainer()));
25
    }
26
27
    /**
28
     * Tests Itafroma\Zork\ServiceContainer::getInstance() with reset.
29
     *
30
     * @covers Itafroma\Zork\ServiceContainer::getContainer
31
     */
32
    public function testGetContainerReset()
33
    {
34
        $container = ServiceContainer::getContainer();
35
36
        $this->assertNotEquals(spl_object_hash($container), spl_object_hash(ServiceContainer::getContainer(true)));
37
    }
38
39
    /**
40
     * Tests Itafroma\Zork\ServiceContainer::create().
41
     *
42
     * @covers Itafroma\Zork\ServiceContainer::create
43
     */
44
    public function testCreate()
45
    {
46
        $this->assertInstanceOf(ContainerBuilder::class, ServiceContainer::create());
47
    }
48
}
49