@@ -3080,6 +3080,38 @@ public function testInsertOrUpdateModeResetsAfterSave()
30803080 ])->save ();
30813081 }
30823082
3083+ public function testInsertOrUpdateWithEmptyConflictColumnsDoesNotWarn ()
3084+ {
3085+ $ table = new Table ('currencies ' , [], $ this ->adapter );
3086+ $ table ->addColumn ('code ' , 'string ' , ['limit ' => 3 ])
3087+ ->addColumn ('rate ' , 'decimal ' , ['precision ' => 10 , 'scale ' => 4 ])
3088+ ->addIndex ('code ' , ['unique ' => true ])
3089+ ->create ();
3090+
3091+ $ warning = null ;
3092+ set_error_handler (function (int $ errno , string $ errstr ) use (&$ warning ) {
3093+ $ warning = $ errstr ;
3094+
3095+ return true ;
3096+ }, E_USER_WARNING );
3097+
3098+ try {
3099+ $ table ->insertOrUpdate ([
3100+ ['code ' => 'USD ' , 'rate ' => 1.0000 ],
3101+ ['code ' => 'EUR ' , 'rate ' => 0.9000 ],
3102+ ], ['rate ' ], [])->save ();
3103+ } finally {
3104+ restore_error_handler ();
3105+ }
3106+
3107+ $ this ->assertNull ($ warning , 'Empty conflictColumns should not trigger a warning for MySQL ' );
3108+
3109+ $ rows = $ this ->adapter ->fetchAll ('SELECT * FROM currencies ORDER BY code ' );
3110+ $ this ->assertCount (2 , $ rows );
3111+ $ this ->assertEquals ('0.9000 ' , $ rows [0 ]['rate ' ]);
3112+ $ this ->assertEquals ('1.0000 ' , $ rows [1 ]['rate ' ]);
3113+ }
3114+
30833115 public function testCreateTableWithRangeColumnsPartitioning ()
30843116 {
30853117 // MySQL requires RANGE COLUMNS for DATE columns
0 commit comments