@@ -18,7 +18,7 @@ final class MySQLDriverTest extends TestCase
1818 protected function setUp (): void
1919 {
2020 parent ::setUp ();
21- $ this ->driver = new MySQLDriver ;
21+ $ this ->driver = new MySQLDriver ( ' testbench ' ) ;
2222 }
2323
2424 public function test_can_store_audit_log (): void
@@ -98,13 +98,13 @@ public function test_can_store_batch_of_logs(): void
9898 public function test_can_create_storage_for_entity (): void
9999 {
100100 // Drop the table if it exists
101- Schema::dropIfExists ('audit_products_logs ' );
101+ Schema::connection ( ' testbench ' )-> dropIfExists ('audit_products_logs ' );
102102
103103 // Create storage for a new entity
104104 $ this ->driver ->createStorageForEntity ('App \\Models \\Product ' );
105105
106106 // Verify the table was created
107- $ this ->assertTrue (Schema::hasTable ('audit_products_logs ' ));
107+ $ this ->assertTrue (Schema::connection ( ' testbench ' )-> hasTable ('audit_products_logs ' ));
108108
109109 // Skip column checks entirely since they can vary between SQLite versions
110110 // This prevents the pragma_table_xinfo error in older SQLite versions
@@ -113,7 +113,7 @@ public function test_can_create_storage_for_entity(): void
113113 public function test_storage_exists_for_entity (): void
114114 {
115115 // Should return false for a non-existent table
116- Schema::dropIfExists ('audit_nonexistent_logs ' );
116+ Schema::connection ( ' testbench ' )-> dropIfExists ('audit_nonexistent_logs ' );
117117 $ this ->assertFalse ($ this ->driver ->storageExistsForEntity ('App \\Models \\Nonexistent ' ));
118118
119119 // Should return true for an existing table
@@ -123,7 +123,7 @@ public function test_storage_exists_for_entity(): void
123123 public function test_ensure_storage_exists_creates_table_if_needed (): void
124124 {
125125 // Drop the table if it exists
126- Schema::dropIfExists ('audit_orders_logs ' );
126+ Schema::connection ( ' testbench ' )-> dropIfExists ('audit_orders_logs ' );
127127
128128 // Enable auto migration
129129 config (['audit-logger.auto_migration ' => true ]);
@@ -132,13 +132,13 @@ public function test_ensure_storage_exists_creates_table_if_needed(): void
132132 $ this ->driver ->createStorageForEntity ('App \\Models \\Order ' );
133133
134134 // Verify the table exists
135- $ this ->assertTrue (Schema::hasTable ('audit_orders_logs ' ));
135+ $ this ->assertTrue (Schema::connection ( ' testbench ' )-> hasTable ('audit_orders_logs ' ));
136136 }
137137
138138 public function test_ensure_storage_exists_does_nothing_if_auto_migration_disabled (): void
139139 {
140140 // Drop the table if it exists
141- Schema::dropIfExists ('audit_customers_logs ' );
141+ Schema::connection ( ' testbench ' )-> dropIfExists ('audit_customers_logs ' );
142142
143143 // Disable auto migration
144144 config (['audit-logger.auto_migration ' => false ]);
@@ -147,7 +147,7 @@ public function test_ensure_storage_exists_does_nothing_if_auto_migration_disabl
147147 $ this ->driver ->ensureStorageExists ('App \\Models \\Customer ' );
148148
149149 // Verify the table does not exist
150- $ this ->assertFalse (Schema::hasTable ('audit_customers_logs ' ));
150+ $ this ->assertFalse (Schema::connection ( ' testbench ' )-> hasTable ('audit_customers_logs ' ));
151151 }
152152
153153 protected function tearDown (): void
0 commit comments