11
11
12
12
namespace Symfony \Component \Lock \Tests \Store ;
13
13
14
+ use Doctrine \DBAL \Configuration ;
14
15
use Doctrine \DBAL \Connection ;
15
16
use Doctrine \DBAL \DriverManager ;
16
17
use Doctrine \DBAL \Exception \TableNotFoundException ;
17
18
use Doctrine \DBAL \Platforms \AbstractPlatform ;
19
+ use Doctrine \DBAL \Schema \DefaultSchemaManagerFactory ;
20
+ use Doctrine \ORM \ORMSetup ;
18
21
use Symfony \Component \Lock \Key ;
19
22
use Symfony \Component \Lock \PersistingStoreInterface ;
20
23
use Symfony \Component \Lock \Store \DoctrineDbalStore ;
@@ -36,7 +39,12 @@ public static function setUpBeforeClass(): void
36
39
{
37
40
self ::$ dbFile = tempnam (sys_get_temp_dir (), 'sf_sqlite_lock ' );
38
41
39
- $ store = new DoctrineDbalStore (DriverManager::getConnection (['driver ' => 'pdo_sqlite ' , 'path ' => self ::$ dbFile ]));
42
+ $ config = class_exists (ORMSetup::class) ? ORMSetup::createConfiguration (true ) : new Configuration ();
43
+ if (class_exists (DefaultSchemaManagerFactory::class)) {
44
+ $ config ->setSchemaManagerFactory (new DefaultSchemaManagerFactory ());
45
+ }
46
+
47
+ $ store = new DoctrineDbalStore (DriverManager::getConnection (['driver ' => 'pdo_sqlite ' , 'path ' => self ::$ dbFile ], $ config ));
40
48
$ store ->createTable ();
41
49
}
42
50
@@ -52,7 +60,12 @@ protected function getClockDelay()
52
60
53
61
public function getStore (): PersistingStoreInterface
54
62
{
55
- return new DoctrineDbalStore (DriverManager::getConnection (['driver ' => 'pdo_sqlite ' , 'path ' => self ::$ dbFile ]));
63
+ $ config = class_exists (ORMSetup::class) ? ORMSetup::createConfiguration (true ) : new Configuration ();
64
+ if (class_exists (DefaultSchemaManagerFactory::class)) {
65
+ $ config ->setSchemaManagerFactory (new DefaultSchemaManagerFactory ());
66
+ }
67
+
68
+ return new DoctrineDbalStore (DriverManager::getConnection (['driver ' => 'pdo_sqlite ' , 'path ' => self ::$ dbFile ], $ config ));
56
69
}
57
70
58
71
public function testAbortAfterExpiration ()
0 commit comments