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
|
|
|
|