|
1
|
|
|
<?php declare(strict_types = 1); |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the Bukashk0zzzLiipImagineSerializationBundle |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Denis Golubovskiy <[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 Bukashk0zzz\LiipImagineSerializationBundle\Tests\DependencyInjection; |
|
12
|
|
|
|
|
13
|
|
|
use Bukashk0zzz\LiipImagineSerializationBundle\DependencyInjection\Bukashk0zzzLiipImagineSerializationExtension; |
|
14
|
|
|
use PHPUnit\Framework\TestCase; |
|
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Bukashk0zzzLiipImagineSerializationTest |
|
19
|
|
|
*/ |
|
20
|
|
|
class Bukashk0zzzLiipImagineSerializationExtensionTest extends TestCase |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var Bukashk0zzzLiipImagineSerializationExtension Bukashk0zzzLiipImagineSerializationExtension |
|
24
|
|
|
*/ |
|
25
|
|
|
private $extension; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var ContainerBuilder Container builder |
|
29
|
|
|
*/ |
|
30
|
|
|
private $container; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* {@inheritdoc} |
|
34
|
|
|
*/ |
|
35
|
|
|
protected function setUp() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->extension = new Bukashk0zzzLiipImagineSerializationExtension(); |
|
38
|
|
|
$this->container = new ContainerBuilder(); |
|
39
|
|
|
$this->container->registerExtension($this->extension); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Test load extension |
|
44
|
|
|
*/ |
|
45
|
|
|
public function testLoadExtension(): void |
|
46
|
|
|
{ |
|
47
|
|
|
// Add some dummy required services |
|
48
|
|
|
$this->container->set('router.request_context', new \stdClass()); |
|
49
|
|
|
$this->container->set('annotations.cached_reader', new \stdClass()); |
|
50
|
|
|
$this->container->set('liip_imagine.cache.manager', new \stdClass()); |
|
51
|
|
|
$this->container->set('vich_uploader.storage', new \stdClass()); |
|
52
|
|
|
$this->container->set('event_dispatcher', new \stdClass()); |
|
53
|
|
|
|
|
54
|
|
|
$this->container->prependExtensionConfig($this->extension->getAlias(), ['includeHost' => true]); |
|
55
|
|
|
$this->container->loadFromExtension($this->extension->getAlias()); |
|
56
|
|
|
$this->container->compile(); |
|
57
|
|
|
|
|
58
|
|
|
// Check that services have been loaded |
|
59
|
|
|
static::assertTrue($this->container->has('bukashk0zzz_liip_imagine_pre_serialization.listener')); |
|
60
|
|
|
static::assertTrue($this->container->has('bukashk0zzz_liip_imagine_post_serialization.listener')); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|