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

testParamConverterExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 15
cts 15
cp 1
rs 9.3142
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
crap 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