@@ -121,7 +121,7 @@ public static function provideCreatesConstraintViolationExceptions(): iterable
121121 ];
122122
123123 yield 'MySQLi check MariaDB ' => [
124- self ::connection (MySQLiConnection::class, ' MySQLi ' ),
124+ self ::mysqliConnectionWithVersion ( ' 10.11.0-MariaDB ' ),
125125 4025 ,
126126 'CONSTRAINT `positive_amount` failed. ' ,
127127 CheckConstraintViolationException::class,
@@ -225,13 +225,6 @@ public static function provideCreatesConstraintViolationExceptions(): iterable
225225 UniqueConstraintViolationException::class,
226226 ];
227227
228- yield 'SQLSRV foreign key ' => [
229- self ::connection (SQLSRVConnection::class, 'SQLSRV ' ),
230- '23000/547 ' ,
231- 'The INSERT statement conflicted with the FOREIGN KEY constraint. ' ,
232- ForeignKeyConstraintViolationException::class,
233- ];
234-
235228 yield 'SQLSRV generic constraint ' => [
236229 self ::connection (SQLSRVConnection::class, 'SQLSRV ' ),
237230 '23000/547 ' ,
@@ -309,7 +302,7 @@ public function testCreatesBaseDatabaseExceptionForNonConstraintError(): void
309302
310303 public function testCreatesBaseDatabaseExceptionForMySQLiNonConstraint4025 (): void
311304 {
312- $ exception = self ::connection (MySQLiConnection::class, ' MySQLi ' )
305+ $ exception = self ::mysqliConnectionWithVersion ( ' 8.4.0 ' )
313306 ->createDatabaseException ('InnoDB autoextend size is out of range. ' , 4025 );
314307
315308 $ this ->assertInstanceOf (DatabaseException::class, $ exception );
@@ -348,6 +341,21 @@ private static function connection(string $connectionClass, string $driver): Bas
348341 return new $ connectionClass (self ::config ($ driver ));
349342 }
350343
344+ private static function mysqliConnectionWithVersion (string $ version ): BaseConnection
345+ {
346+ return new class (self ::config ('MySQLi ' ), $ version ) extends MySQLiConnection {
347+ public function __construct (array $ params , private readonly string $ version )
348+ {
349+ parent ::__construct ($ params );
350+ }
351+
352+ public function getVersion (): string
353+ {
354+ return $ this ->version ;
355+ }
356+ };
357+ }
358+
351359 /**
352360 * @return array<string, mixed>
353361 */
0 commit comments