/
GpsLabDomainEventBundleTest.php
56 lines (47 loc) · 1.58 KB
/
GpsLabDomainEventBundleTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* GpsLab component.
*
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2016, Peter Gribanov
* @license http://opensource.org/licenses/MIT
*/
namespace GpsLab\Bundle\DomainEvent\Tests;
use GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler\EventListenerPass;
use GpsLab\Bundle\DomainEvent\DependencyInjection\GpsLabDomainEventExtension;
use GpsLab\Bundle\DomainEvent\GpsLabDomainEventBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class GpsLabDomainEventBundleTest extends \PHPUnit_Framework_TestCase
{
/**
* @var GpsLabDomainEventBundle
*/
private $bundle;
/**
* @var ContainerBuilder
*/
private $container;
protected function setUp()
{
$this->bundle = new GpsLabDomainEventBundle();
$this->container = new ContainerBuilder();
}
public function testCorrectBundle()
{
$this->assertInstanceOf(Bundle::class, $this->bundle);
}
public function testBuild()
{
$this->bundle->build($this->container);
$has_event_listener_pass = false;
foreach ($this->container->getCompiler()->getPassConfig()->getBeforeOptimizationPasses() as $pass) {
$has_event_listener_pass = $pass instanceof EventListenerPass ?: $has_event_listener_pass;
}
$this->assertTrue($has_event_listener_pass);
}
public function testContainerExtension()
{
$this->assertInstanceOf(GpsLabDomainEventExtension::class, $this->bundle->getContainerExtension());
}
}