@@ -408,22 +408,23 @@ public function testInsert(
408
408
parent ::testInsert ($ table , $ columns , $ params , $ expectedSQL , $ expectedParams );
409
409
}
410
410
411
- #[DataProviderExternal(QueryBuilderProvider::class, 'insertWithReturningPks ' )]
412
- public function testInsertWithReturningPks (
411
+ #[DataProviderExternal(QueryBuilderProvider::class, 'insertReturningPks ' )]
412
+ public function testInsertReturningPks (
413
413
string $ table ,
414
414
array |QueryInterface $ columns ,
415
415
array $ params ,
416
416
string $ expectedSQL ,
417
417
array $ expectedParams
418
418
): void {
419
+ $ db = $ this ->getConnection ();
420
+ $ qb = $ db ->getQueryBuilder ();
421
+
419
422
$ this ->expectException (NotSupportedException::class);
420
423
$ this ->expectExceptionMessage (
421
- 'Yiisoft\Db\Mysql\DMLQueryBuilder::insertWithReturningPks is not supported by MySQL. '
424
+ 'Yiisoft\Db\Mysql\DMLQueryBuilder::insertReturningPks is not supported by MySQL. '
422
425
);
423
426
424
- $ db = $ this ->getConnection (true );
425
- $ qb = $ db ->getQueryBuilder ();
426
- $ qb ->insertWithReturningPks ($ table , $ columns , $ params );
427
+ $ qb ->insertReturningPks ($ table , $ columns , $ params );
427
428
428
429
$ db ->close ();
429
430
}
@@ -515,7 +516,7 @@ public function testResetSequence(): void
515
516
$ this ->assertSame ($ sql , $ qb ->resetSequence ('item ' ));
516
517
517
518
$ command ->setSql ($ sql )->execute ();
518
- $ insertResult = $ command ->insertWithReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
519
+ $ insertResult = $ command ->insertReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
519
520
$ this ->assertEquals (6 , $ insertResult ['id ' ]);
520
521
521
522
// Key as string.
@@ -526,7 +527,7 @@ public function testResetSequence(): void
526
527
$ this ->assertSame ($ sql , $ qb ->resetSequence ('item ' , '40 ' ));
527
528
528
529
$ command ->setSql ($ sql )->execute ();
529
- $ insertResult = $ command ->insertWithReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
530
+ $ insertResult = $ command ->insertReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
530
531
$ this ->assertEquals (40 , $ insertResult ['id ' ]);
531
532
532
533
// Change up, key as int.
@@ -537,7 +538,7 @@ public function testResetSequence(): void
537
538
$ this ->assertSame ($ sql , $ qb ->resetSequence ('item ' , 43 ));
538
539
539
540
$ db ->createCommand ($ sql )->execute ();
540
- $ insertResult = $ command ->insertWithReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
541
+ $ insertResult = $ command ->insertReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
541
542
$ this ->assertEquals (43 , $ insertResult ['id ' ]);
542
543
543
544
$ command ->delete ('item ' , ['>= ' ,'id ' , 6 ])->execute ();
@@ -552,7 +553,7 @@ public function testResetSequence(): void
552
553
$ this ->assertSame ($ sql , $ qb ->resetSequence ('item ' ));
553
554
554
555
$ db ->createCommand ($ sql )->execute ();
555
- $ insertResult = $ command ->insertWithReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
556
+ $ insertResult = $ command ->insertReturningPks ('item ' , ['name ' => '123 ' , 'category_id ' => 1 ]);
556
557
$ this ->assertEquals (6 , $ insertResult ['id ' ]);
557
558
558
559
$ db ->close ();
0 commit comments