File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,8 @@ public function hasChanged(?string $key = null): bool
256
256
return $ this ->original !== $ this ->attributes ;
257
257
}
258
258
259
+ $ key = $ this ->mapProperty ($ key );
260
+
259
261
// Key doesn't exist in either
260
262
if (! array_key_exists ($ key , $ this ->original ) && ! array_key_exists ($ key , $ this ->attributes )) {
261
263
return false ;
Original file line number Diff line number Diff line change @@ -929,6 +929,24 @@ public function testHasChangedNoChange()
929
929
$ this ->assertFalse ($ entity ->hasChanged ('default ' ));
930
930
}
931
931
932
+ public function testHasChangedMappedNoChange ()
933
+ {
934
+ $ entity = $ this ->getEntity ();
935
+
936
+ $ entity ->createdAt = null ;
937
+
938
+ $ this ->assertFalse ($ entity ->hasChanged ('createdAt ' ));
939
+ }
940
+
941
+ public function testHasChangedMappedChanged ()
942
+ {
943
+ $ entity = $ this ->getEntity ();
944
+
945
+ $ entity ->createdAt = '2022-11-11 11:11:11 ' ;
946
+
947
+ $ this ->assertTrue ($ entity ->hasChanged ('createdAt ' ));
948
+ }
949
+
932
950
public function testHasChangedWholeEntity ()
933
951
{
934
952
$ entity = $ this ->getEntity ();
You can’t perform that action at this time.
0 commit comments