55namespace Yokai \Batch \Tests \Bridge \Doctrine \DBAL ;
66
77use DateTimeImmutable ;
8+ use Doctrine \DBAL \Schema \Table ;
9+ use Doctrine \DBAL \Types \Types ;
810use Generator ;
911use RuntimeException ;
1012use Throwable ;
@@ -31,7 +33,7 @@ private function createStorage(array $options = []): DoctrineDBALJobExecutionSto
3133
3234 public function testCreateStandardTable (): void
3335 {
34- $ schemaManager = $ this ->connection ->getSchemaManager ();
36+ $ schemaManager = $ this ->connection ->createSchemaManager ();
3537
3638 self ::assertFalse ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
3739 $ this ->createStorage ()->setup ();
@@ -58,7 +60,7 @@ public function testCreateStandardTable(): void
5860
5961 public function testCreateCustomTable (): void
6062 {
61- $ schemaManager = $ this ->connection ->getSchemaManager ();
63+ $ schemaManager = $ this ->connection ->createSchemaManager ();
6264
6365 self ::assertFalse ($ schemaManager ->tablesExist (['acme_job_executions ' ]));
6466 $ this ->createStorage (['table ' => 'acme_job_executions ' ])->setup ();
@@ -83,6 +85,20 @@ public function testCreateCustomTable(): void
8385 );
8486 }
8587
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+
86102 public function testStoreInsert (): void
87103 {
88104 $ storage = $ this ->createStorage ();
@@ -345,7 +361,7 @@ public function queries(): Generator
345361
346362 public function testCreateSchemaDeprecated (): void
347363 {
348- $ schemaManager = $ this ->connection ->getSchemaManager ();
364+ $ schemaManager = $ this ->connection ->createSchemaManager ();
349365 self ::assertFalse ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
350366 $ this ->createStorage ()->createSchema ();
351367 self ::assertTrue ($ schemaManager ->tablesExist (['yokai_batch_job_execution ' ]));
0 commit comments