Completed
Pull Request — master (#4)
by Pavel
10:02
created

SensioFrameworkExtraTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 8
dl 0
loc 48
ccs 27
cts 27
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testParamConverterExists() 0 21 1
A testParamConverterExistsDoesNotExistWithoutBundle() 0 15 1
A getCacheDir() 0 4 1
1
<?php
2
3
namespace Bankiru\Api\Tests;
4
5
use Bankiru\Api\BankiruDoctrineApiBundle;
6
use Bankiru\Api\Doctrine\Test\Entity\TestEntity;
7
use Bankiru\Api\Doctrine\Test\TestBundle;
8
use PHPUnit\Framework\TestCase;
9
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
10
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
11
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
12
13
final class SensioFrameworkExtraTest extends TestCase
14
{
15
    use ContainerTestTrait;
16
17 1
    public function testParamConverterExists()
18
    {
19 1
        $container = $this->buildContainer(
20
            [
21 1
                new BankiruDoctrineApiBundle(),
22 1
                new SensioFrameworkExtraBundle(),
23 1
                new TestBundle(),
24 1
            ],
25 1
            [],
26
            false
27 1
        );
28 1
        $container->set('kernel', new KernelForTest('test', true));
29 1
        $container = $this->compile($container);
30
31 1
        self::assertTrue($container->has('bankiru_api.sensio_bridge.doctrine_param_converter'));
32
33 1
        $configuration = new ParamConverter([]);
34 1
        $configuration->setClass(TestEntity::class);
35
36 1
        $container->get('bankiru_api.sensio_bridge.doctrine_param_converter')->supports($configuration);
37 1
    }
38
39 1
    public function testParamConverterExistsDoesNotExistWithoutBundle()
40
    {
41 1
        $container = $this->buildContainer(
42
            [
43 1
                new BankiruDoctrineApiBundle(),
44 1
                new TestBundle(),
45 1
            ],
46 1
            [],
47
            false
48 1
        );
49
50 1
        $container = $this->compile($container);
51
52 1
        self::assertFalse($container->has('bankiru_api.sensio_bridge.doctrine_param_converter'));
53 1
    }
54
55
    /** {@inheritdoc} */
56 2
    protected function getCacheDir()
57
    {
58 2
        return CACHE_DIR;
59
    }
60
}
61