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
256256 return $ this ->original !== $ this ->attributes ;
257257 }
258258
259+ $ key = $ this ->mapProperty ($ key );
260+
259261 // Key doesn't exist in either
260262 if (! array_key_exists ($ key , $ this ->original ) && ! array_key_exists ($ key , $ this ->attributes )) {
261263 return false ;
Original file line number Diff line number Diff line change @@ -929,6 +929,24 @@ public function testHasChangedNoChange()
929929 $ this ->assertFalse ($ entity ->hasChanged ('default ' ));
930930 }
931931
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+
932950 public function testHasChangedWholeEntity ()
933951 {
934952 $ entity = $ this ->getEntity ();
You can’t perform that action at this time.
0 commit comments