@@ -85,20 +85,48 @@ public static function provideCreatesConstraintViolationExceptions(): iterable
8585 ForeignKeyConstraintViolationException::class,
8686 ];
8787
88+ yield 'MySQLi foreign key parent row referenced legacy code ' => [
89+ self ::connection (MySQLiConnection::class, 'MySQLi ' ),
90+ 1217 ,
91+ 'Cannot delete or update a parent row: a foreign key constraint fails. ' ,
92+ ForeignKeyConstraintViolationException::class,
93+ ];
94+
95+ yield 'MySQLi foreign key child row missing parent legacy code ' => [
96+ self ::connection (MySQLiConnection::class, 'MySQLi ' ),
97+ 1216 ,
98+ 'Cannot add or update a child row: a foreign key constraint fails. ' ,
99+ ForeignKeyConstraintViolationException::class,
100+ ];
101+
88102 yield 'MySQLi not null ' => [
89103 self ::connection (MySQLiConnection::class, 'MySQLi ' ),
90104 1048 ,
91105 "Column 'name' cannot be null " ,
92106 NotNullConstraintViolationException::class,
93107 ];
94108
109+ yield 'MySQLi not null ignored ' => [
110+ self ::connection (MySQLiConnection::class, 'MySQLi ' ),
111+ 3673 ,
112+ "Column 'name' cannot be null " ,
113+ NotNullConstraintViolationException::class,
114+ ];
115+
95116 yield 'MySQLi check ' => [
96117 self ::connection (MySQLiConnection::class, 'MySQLi ' ),
97118 3819 ,
98119 "Check constraint 'positive_amount' is violated. " ,
99120 CheckConstraintViolationException::class,
100121 ];
101122
123+ yield 'MySQLi check MariaDB ' => [
124+ self ::connection (MySQLiConnection::class, 'MySQLi ' ),
125+ 4025 ,
126+ 'CONSTRAINT `positive_amount` failed. ' ,
127+ CheckConstraintViolationException::class,
128+ ];
129+
102130 yield 'Postgre foreign key ' => [
103131 self ::connection (PostgreConnection::class, 'Postgre ' ),
104132 '23503 ' ,
@@ -247,6 +275,13 @@ public static function provideCreatesConstraintViolationExceptions(): iterable
247275 NotNullConstraintViolationException::class,
248276 ];
249277
278+ yield 'OCI8 not null update ' => [
279+ self ::connection (OCI8Connection::class, 'OCI8 ' ),
280+ 1407 ,
281+ 'Cannot update to NULL. ' ,
282+ NotNullConstraintViolationException::class,
283+ ];
284+
250285 yield 'OCI8 check ' => [
251286 self ::connection (OCI8Connection::class, 'OCI8 ' ),
252287 2290 ,
@@ -265,6 +300,15 @@ public function testCreatesBaseDatabaseExceptionForNonConstraintError(): void
265300 $ this ->assertNotInstanceOf (ConstraintViolationException::class, $ exception );
266301 }
267302
303+ public function testCreatesBaseDatabaseExceptionForMySQLiNonConstraint4025 (): void
304+ {
305+ $ exception = self ::connection (MySQLiConnection::class, 'MySQLi ' )
306+ ->createDatabaseException ('InnoDB autoextend size is out of range. ' , 4025 );
307+
308+ $ this ->assertInstanceOf (DatabaseException::class, $ exception );
309+ $ this ->assertNotInstanceOf (ConstraintViolationException::class, $ exception );
310+ }
311+
268312 #[DataProvider('provideCreatesBaseDatabaseExceptionForSqlsrvConstraintVendorCodeWithNonConstraintSqlstate ' )]
269313 public function testCreatesBaseDatabaseExceptionForSqlsrvConstraintVendorCodeWithNonConstraintSqlstate (string $ code ): void
270314 {
0 commit comments