File tree 1 file changed +46
-0
lines changed
tests/DependencyInjection/Compiler
1 file changed +46
-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
+ $ filePath = (new \ReflectionClass (ValidationCompilerPass::class))->getFileName ();
32
+ \assert (\is_string ($ filePath ));
33
+ $ compilePassDir = \dirname ($ filePath );
34
+
35
+ $ this ->assertContainerBuilderHasServiceDefinitionWithMethodCall (
36
+ 'validator.builder ' ,
37
+ 'addXmlMapping ' ,
38
+ [$ compilePassDir .'/../../Resources/config/storage-validation/orm.xml ' ]
39
+ );
40
+ }
41
+
42
+ protected function registerCompilerPass (ContainerBuilder $ container ): void
43
+ {
44
+ $ container ->addCompilerPass (new ValidationCompilerPass ());
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments