11
11
12
12
namespace Symfony \Component \Messenger \Tests \Transport \Doctrine ;
13
13
14
- use Doctrine \Common \Persistence \ConnectionRegistry ;
14
+ use Doctrine \Common \Persistence \ConnectionRegistry as LegacyConnectionRegistry ;
15
15
use Doctrine \DBAL \Schema \AbstractSchemaManager ;
16
16
use Doctrine \DBAL \Schema \SchemaConfig ;
17
+ use Doctrine \Persistence \ConnectionRegistry ;
17
18
use PHPUnit \Framework \TestCase ;
18
19
use Symfony \Component \Messenger \Transport \Doctrine \Connection ;
19
20
use Symfony \Component \Messenger \Transport \Doctrine \DoctrineTransport ;
@@ -25,7 +26,7 @@ class DoctrineTransportFactoryTest extends TestCase
25
26
public function testSupports ()
26
27
{
27
28
$ factory = new DoctrineTransportFactory (
28
- $ this ->createMock (ConnectionRegistry::class)
29
+ $ this ->createMock (interface_exists ( ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry ::class)
29
30
);
30
31
31
32
$ this ->assertTrue ($ factory ->supports ('doctrine://default ' , []));
@@ -39,7 +40,7 @@ public function testCreateTransport()
39
40
$ schemaConfig = $ this ->createMock (SchemaConfig::class);
40
41
$ schemaManager ->method ('createSchemaConfig ' )->willReturn ($ schemaConfig );
41
42
$ driverConnection ->method ('getSchemaManager ' )->willReturn ($ schemaManager );
42
- $ registry = $ this ->createMock (ConnectionRegistry::class);
43
+ $ registry = $ this ->createMock (interface_exists ( ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry ::class);
43
44
44
45
$ registry ->expects ($ this ->once ())
45
46
->method ('getConnection ' )
@@ -58,7 +59,7 @@ public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
58
59
{
59
60
$ this ->expectException ('Symfony\Component\Messenger\Exception\TransportException ' );
60
61
$ this ->expectExceptionMessage ('Could not find Doctrine connection from Messenger DSN "doctrine://default". ' );
61
- $ registry = $ this ->createMock (ConnectionRegistry::class);
62
+ $ registry = $ this ->createMock (interface_exists ( ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry ::class);
62
63
$ registry ->expects ($ this ->once ())
63
64
->method ('getConnection ' )
64
65
->willReturnCallback (function () {
0 commit comments