11<?php
2+ declare (strict_types=1 );
23
34namespace Itosho \EasyQuery \Test \TestCase \Model \Behavior ;
45
@@ -28,7 +29,7 @@ class UpsertBehaviorTest extends TestCase
2829 /**
2930 * {@inheritDoc}
3031 */
31- public function setUp ()
32+ public function setUp (): void
3233 {
3334 parent ::setUp ();
3435 $ this ->Tags = TableRegistry::getTableLocator ()->get ('Itosho/EasyQuery.Tags ' );
@@ -41,7 +42,7 @@ public function setUp()
4142 /**
4243 * {@inheritDoc}
4344 */
44- public function tearDown ()
45+ public function tearDown (): void
4546 {
4647 parent ::tearDown ();
4748 TableRegistry::getTableLocator ()->clear ();
@@ -237,12 +238,13 @@ public function testUpsertNoBeforeSave()
237238 /**
238239 * upsert() test when invalid update columns
239240 *
240- * @expectedException \LogicException
241- * @expectedExceptionMessage config updateColumns is invalid.
242241 * @return void
243242 */
244243 public function testUpsertInvalidUpdateColumnsConfig ()
245244 {
245+ $ this ->expectExceptionMessage ("config updateColumns is invalid. " );
246+ $ this ->expectException (\LogicException::class);
247+
246248 $ this ->Tags ->removeBehavior ('Upsert ' );
247249 $ this ->Tags ->addBehavior ('Itosho/EasyQuery.Upsert ' , [
248250 'uniqueColumns ' => ['name ' ],
@@ -261,12 +263,13 @@ public function testUpsertInvalidUpdateColumnsConfig()
261263 /**
262264 * upsert() test when invalid unique columns
263265 *
264- * @expectedException \LogicException
265- * @expectedExceptionMessage config uniqueColumns is invalid.
266266 * @return void
267267 */
268268 public function testUpsertInvalidUniqueColumnsConfig ()
269269 {
270+ $ this ->expectExceptionMessage ("config uniqueColumns is invalid. " );
271+ $ this ->expectException (\LogicException::class);
272+
270273 $ this ->Tags ->removeBehavior ('Upsert ' );
271274 $ this ->Tags ->addBehavior ('Itosho/EasyQuery.Upsert ' , [
272275 'updateColumns ' => ['description ' , 'modified ' ],
@@ -434,12 +437,13 @@ public function testBulkUpsertNoBeforeSave()
434437 /**
435438 * bulkUpsert() test when invalid update columns
436439 *
437- * @expectedException \LogicException
438- * @expectedExceptionMessage config updateColumns is invalid.
439440 * @return void
440441 */
441442 public function testBulkUpsertInvalidUpdateColumnsConfig ()
442443 {
444+ $ this ->expectExceptionMessage ("config updateColumns is invalid. " );
445+ $ this ->expectException (\LogicException::class);
446+
443447 $ this ->Tags ->removeBehavior ('Upsert ' );
444448 $ this ->Tags ->addBehavior ('Itosho/EasyQuery.Upsert ' );
445449
@@ -457,12 +461,13 @@ public function testBulkUpsertInvalidUpdateColumnsConfig()
457461 /**
458462 * bulkUpsert() test by no data
459463 *
460- * @expectedException \LogicException
461- * @expectedExceptionMessage entities has no save data.
462464 * @return void
463465 */
464466 public function testBulkUpsertNoSaveData ()
465467 {
468+ $ this ->expectExceptionMessage ("entities has no save data. " );
469+ $ this ->expectException (\LogicException::class);
470+
466471 $ this ->Tags ->removeBehavior ('Upsert ' );
467472 $ this ->Tags ->addBehavior ('Itosho/EasyQuery.Upsert ' , [
468473 'updateColumns ' => ['description ' , 'modified ' ],
@@ -476,7 +481,7 @@ public function testBulkUpsertNoSaveData()
476481 *
477482 * @return array
478483 */
479- private function getBaseInsertRecords ()
484+ private function getBaseInsertRecords (): array
480485 {
481486 return [
482487 [
@@ -499,7 +504,7 @@ private function getBaseInsertRecords()
499504 *
500505 * @return array
501506 */
502- private function getBaseUpdateRecords ()
507+ private function getBaseUpdateRecords (): array
503508 {
504509 return [
505510 [
0 commit comments