File tree 1 file changed +44
-0
lines changed
tests/DependencyInjection/Compiler
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /*
6
+ * This file is part of the Sonata Project package.
7
+ *
8
+ * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ namespace Sonata \UserBundle \Tests \DependencyInjection \Compiler ;
15
+
16
+ use Matthias \SymfonyDependencyInjectionTest \PhpUnit \AbstractCompilerPassTestCase ;
17
+ use Sonata \UserBundle \DependencyInjection \Compiler \ValidationCompilerPass ;
18
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
19
+ use Symfony \Component \DependencyInjection \Definition ;
20
+ use Symfony \Component \Validator \ValidatorBuilder ;
21
+
22
+ final class ValidationCompilerPassTest extends AbstractCompilerPassTestCase
23
+ {
24
+ public function testProcess (): void
25
+ {
26
+ $ this ->container ->setParameter ('sonata.user.manager_type ' , 'orm ' );
27
+ $ this ->container ->setDefinition ('validator.builder ' , new Definition (ValidatorBuilder::class));
28
+
29
+ $ this ->compile ();
30
+
31
+ $ compilePassDir = dirname ((new \ReflectionClass (ValidationCompilerPass::class))->getFileName ());
32
+
33
+ $ this ->assertContainerBuilderHasServiceDefinitionWithMethodCall (
34
+ 'validator.builder ' ,
35
+ 'addXmlMapping ' ,
36
+ [$ compilePassDir .'/../../Resources/config/storage-validation/orm.xml ' ]
37
+ );
38
+ }
39
+
40
+ protected function registerCompilerPass (ContainerBuilder $ container ): void
41
+ {
42
+ $ container ->addCompilerPass (new ValidationCompilerPass ());
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments