-
-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy pathBundleTest.php
More file actions
48 lines (40 loc) · 1.91 KB
/
BundleTest.php
File metadata and controls
48 lines (40 loc) · 1.91 KB
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
<?php
declare(strict_types=1);
namespace Doctrine\Bundle\DoctrineBundle\Tests;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DbalSchemaFilterPass;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\RegisterDbalTypePass;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class BundleTest extends TestCase
{
public function testBuildCompilerPasses(): void
{
$container = new ContainerBuilder();
$bundle = new DoctrineBundle();
$bundle->build($container);
$config = $container->getCompilerPassConfig();
$passes = $config->getBeforeOptimizationPasses();
$foundEventListener = false;
$foundValidation = false;
$foundSchemaFilter = false;
$foundRegisterDbalType = false;
foreach ($passes as $pass) {
if ($pass instanceof RegisterEventListenersAndSubscribersPass) {
$foundEventListener = true;
} elseif ($pass instanceof DoctrineValidationPass) {
$foundValidation = true;
} elseif ($pass instanceof DbalSchemaFilterPass) {
$foundSchemaFilter = true;
} elseif ($pass instanceof RegisterDbalTypePass) {
$foundRegisterDbalType = true;
}
}
$this->assertTrue($foundEventListener, 'RegisterEventListenersAndSubscribersPass was not found');
$this->assertTrue($foundValidation, 'DoctrineValidationPass was not found');
$this->assertTrue($foundSchemaFilter, 'DbalSchemaFilterPass was not found');
$this->assertTrue($foundRegisterDbalType, 'RegisterDbalTypePass was not found');
}
}