File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
DependencyInjection/CompilerPass
Tests/DependencyInjection/CompilerPass Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ public function process(ContainerBuilder $container)
28
28
return ;
29
29
}
30
30
31
+ if (!$ container ->hasParameter ('doctrine.dbal.connection_factory.types ' )) {
32
+ return ;
33
+ }
34
+
31
35
$ typeDefinition = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
32
36
33
37
if (!isset ($ typeDefinition ['uuid ' ])) {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Bridge \Doctrine \Tests \DependencyInjection \CompilerPass ;
4
+
5
+ use PHPUnit \Framework \TestCase ;
6
+ use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \RegisterUidTypePass ;
7
+ use Symfony \Bridge \Doctrine \Types \UlidType ;
8
+ use Symfony \Bridge \Doctrine \Types \UuidType ;
9
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
10
+
11
+ class RegisterUidTypePassTest extends TestCase
12
+ {
13
+ public function testRegistered ()
14
+ {
15
+ $ container = new ContainerBuilder ();
16
+ $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , ['foo ' => 'bar ' ]);
17
+ (new RegisterUidTypePass ())->process ($ container );
18
+
19
+ $ expected = [
20
+ 'foo ' => 'bar ' ,
21
+ 'uuid ' => ['class ' => UuidType::class],
22
+ 'ulid ' => ['class ' => UlidType::class],
23
+ ];
24
+ $ this ->assertSame ($ expected , $ container ->getParameter ('doctrine.dbal.connection_factory.types ' ));
25
+ }
26
+
27
+ public function testRegisteredDontFail ()
28
+ {
29
+ $ container = new ContainerBuilder ();
30
+ (new RegisterUidTypePass ())->process ($ container );
31
+
32
+ $ this ->expectNotToPerformAssertions ();
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments