@@ -378,6 +378,51 @@ public function testUpdateWithEntityNoAllowedFields(): void
378
378
$ this ->model ->update ($ id , $ entity );
379
379
}
380
380
381
+ public function testUpdateSetObject (): void
382
+ {
383
+ $ this ->createModel (UserModel::class);
384
+
385
+ $ object = new stdClass ();
386
+ $ object ->name = 'Jones Martin ' ;
387
+ $ object ->email = 'jones@example.org ' ;
388
+ $ object ->country = 'India ' ;
389
+
390
+ /** @var int|string $id */
391
+ $ id = $ this ->model ->insert ($ object );
392
+
393
+ /** @var stdClass $object */
394
+ $ object = $ this ->model ->find ($ id );
395
+ $ object ->name = 'John Smith ' ;
396
+
397
+ $ return = $ this ->model ->where ('id ' , $ id )->set ($ object )->update ();
398
+
399
+ $ this ->assertTrue ($ return );
400
+ }
401
+
402
+ public function testUpdateSetEntity (): void
403
+ {
404
+ $ this ->createModel (UserModel::class);
405
+
406
+ $ object = new stdClass ();
407
+ $ object ->id = 1 ;
408
+ $ object ->name = 'Jones Martin ' ;
409
+ $ object ->email = 'jones@example.org ' ;
410
+ $ object ->country = 'India ' ;
411
+
412
+ $ id = $ this ->model ->insert ($ object );
413
+
414
+ $ entity = new Entity ([
415
+ 'id ' => 1 ,
416
+ 'name ' => 'John Smith ' ,
417
+ 'email ' => 'john@example.org ' ,
418
+ 'country ' => 'India ' ,
419
+ ]);
420
+
421
+ $ return = $ this ->model ->where ('id ' , $ id )->set ($ entity )->update ();
422
+
423
+ $ this ->assertTrue ($ return );
424
+ }
425
+
381
426
public function testUpdateEntityWithPrimaryKeyCast (): void
382
427
{
383
428
if (
0 commit comments