5
5
namespace Yokai \Batch \Tests \Bridge \Doctrine \DBAL ;
6
6
7
7
use DateTimeImmutable ;
8
+ use Doctrine \DBAL \Schema \Table ;
9
+ use Doctrine \DBAL \Types \Types ;
8
10
use Generator ;
9
11
use RuntimeException ;
10
12
use Throwable ;
@@ -31,7 +33,7 @@ private function createStorage(array $options = []): DoctrineDBALJobExecutionSto
31
33
32
34
public function testCreateStandardTable (): void
33
35
{
34
- $ schemaManager = $ this ->connection ->getSchemaManager ();
36
+ $ schemaManager = $ this ->connection ->createSchemaManager ();
35
37
36
38
self ::assertFalse ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
37
39
$ this ->createStorage ()->setup ();
@@ -58,7 +60,7 @@ public function testCreateStandardTable(): void
58
60
59
61
public function testCreateCustomTable (): void
60
62
{
61
- $ schemaManager = $ this ->connection ->getSchemaManager ();
63
+ $ schemaManager = $ this ->connection ->createSchemaManager ();
62
64
63
65
self ::assertFalse ($ schemaManager ->tablesExist (['acme_job_executions ' ]));
64
66
$ this ->createStorage (['table ' => 'acme_job_executions ' ])->setup ();
@@ -83,6 +85,20 @@ public function testCreateCustomTable(): void
83
85
);
84
86
}
85
87
88
+ public function testSetupPreserveOtherTables (): void
89
+ {
90
+ $ schemaManager = $ this ->connection ->createSchemaManager ();
91
+ $ table = new Table ('user ' );
92
+ $ table ->addColumn ('username ' , Types::STRING );
93
+ $ schemaManager ->createTable ($ table );
94
+
95
+ self ::assertTrue ($ schemaManager ->tablesExist (['user ' ]));
96
+ self ::assertFalse ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
97
+ $ this ->createStorage ()->setup ();
98
+ self ::assertTrue ($ schemaManager ->tablesExist (['user ' ]));
99
+ self ::assertTrue ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
100
+ }
101
+
86
102
public function testStoreInsert (): void
87
103
{
88
104
$ storage = $ this ->createStorage ();
@@ -345,7 +361,7 @@ public function queries(): Generator
345
361
346
362
public function testCreateSchemaDeprecated (): void
347
363
{
348
- $ schemaManager = $ this ->connection ->getSchemaManager ();
364
+ $ schemaManager = $ this ->connection ->createSchemaManager ();
349
365
self ::assertFalse ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
350
366
$ this ->createStorage ()->createSchema ();
351
367
self ::assertTrue ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
0 commit comments