OpenExchangeRatesServiceTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getServiceConfig() 0 6 1
A setUp() 0 7 1
A testServiceIsGettable() 0 7 1
1
<?php
2
3
namespace Mrzard\OpenExchangeRatesBundle\Tests;
4
5
use Mrzard\OpenExchangeRates\Service\OpenExchangeRatesService;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
use Symfony\Bundle\FrameworkBundle\Console\Application;
8
use Symfony\Component\HttpKernel\KernelInterface;
9
10
class OpenExchangeRatesServiceTest extends WebTestCase
11
{
12
    /**
13
     * @var Application|null
14
     */
15
    protected static $application = null;
16
17
    /**
18
     * @var KernelInterface|null
19
     */
20
    protected static $kernel = null;
21
22
    /**
23
     * @var OpenExchangeRatesService
24
     */
25
    protected $service;
26
27
    /**
28
     * Get service configuration
29
     *
30
     * @return array
31
     */
32
    protected function getServiceConfig()
33
    {
34
        return static::$kernel->getContainer()->getParameter(
35
            'open_exchange_rates_service.api_configuration'
36
        );
37
    }
38
39
    /**
40
     * Set up test
41
     */
42
    public function setUp()
43
    {
44
        static::$kernel = static::createKernel();
45
        static::$kernel->boot();
46
        static::$application = new Application(static::$kernel);
47
        static::$application->setAutoExit(false);
48
    }
49
50
    /**
51
     * Checks if the app can get the service from the container
52
     */
53
    public function testServiceIsGettable()
54
    {
55
        $serviceCallableName = 'open_exchange_rates_service';
56
        $this->assertTrue(static::$kernel->getContainer()->has($serviceCallableName));
57
        static::$kernel->getContainer()->get($serviceCallableName);
58
        $this->assertTrue(true);
59
    }
60
}