Passed
Pull Request — master (#3)
by Vincent
08:42
created

ConfigurationResolverTest::test_get_config()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Bdf\PrimeBundle\Tests\Connection;
4
5
use Bdf\Prime\Configuration;
6
use Bdf\PrimeBundle\Connection\ConfigurationResolver;
7
use PHPUnit\Framework\TestCase;
8
use Psr\Container\ContainerInterface;
9
10
/**
11
 *
12
 */
13
class ConfigurationResolverTest extends TestCase
14
{
15
    /**
16
     *
17
     */
18
    public function test_unknwon_key()
19
    {
20
        $container = $this->createMock(ContainerInterface::class);
21
22
        $resolver = new ConfigurationResolver($container);
23
24
        $this->assertNull($resolver->getConfiguration('unknown'));
25
    }
26
27
    /**
28
     *
29
     */
30
    public function test_get_config()
31
    {
32
        $configuration = new Configuration();
33
        $container = $this->createMock(ContainerInterface::class);
34
        $container->expects($this->once())->method('get')->with('test')->willReturn($configuration);
35
36
        $resolver = new ConfigurationResolver($container, '%s');
37
38
        $this->assertSame($configuration, $resolver->getConfiguration('test'));
39
    }
40
}