ServiceContainerTest::testGetContainerReset()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
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