1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the FreshVichUploaderSerializationBundle |
4
|
|
|
* |
5
|
|
|
* (c) Artem Genvald <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Fresh\VichUploaderSerializationBundle\Tests\DependencyInjection; |
12
|
|
|
|
13
|
|
|
use Fresh\VichUploaderSerializationBundle\DependencyInjection\FreshVichUploaderSerializationExtension; |
14
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* FreshVichUploaderSerializationExtensionTest |
18
|
|
|
* |
19
|
|
|
* @author Artem Genvald <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class FreshVichUploaderSerializationExtensionTest extends \PHPUnit_Framework_TestCase |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var FreshVichUploaderSerializationExtension $extension FreshVichUploaderSerializationExtension |
25
|
|
|
*/ |
26
|
|
|
private $extension; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var ContainerBuilder $container Container builder |
30
|
|
|
*/ |
31
|
|
|
private $container; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* {@inheritdoc} |
35
|
|
|
*/ |
36
|
|
|
protected function setUp() |
37
|
|
|
{ |
38
|
|
|
$this->extension = new FreshVichUploaderSerializationExtension(); |
39
|
|
|
$this->container = new ContainerBuilder(); |
40
|
|
|
$this->container->registerExtension($this->extension); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Test load extension |
45
|
|
|
*/ |
46
|
|
|
public function testLoadExtension() |
47
|
|
|
{ |
48
|
|
|
// Add some dummy required services |
49
|
|
|
$this->container->set('vich_uploader.storage', new \StdClass()); |
50
|
|
|
$this->container->set('router.request_context', new \StdClass()); |
51
|
|
|
$this->container->set('annotations.cached_reader', new \StdClass()); |
52
|
|
|
$this->container->set('logger', new \StdClass()); |
53
|
|
|
|
54
|
|
|
$this->container->loadFromExtension($this->extension->getAlias()); |
55
|
|
|
$this->container->compile(); |
56
|
|
|
|
57
|
|
|
// Check that services have been loaded |
58
|
|
|
$this->assertTrue($this->container->has('vich_uploader.jms_serializer.listener')); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|