The vast majority of our unit tests use $model = $model->fresh() which creates a brand new instance of the Model object in memory, all caches are by definition reset. The Laravel method $model->refresh() superficially looks the same but it's zeroing out all the caches base Laravel knows about, and doesn't catch our new $jsonModelAttributeCache.
Add support in HasJsonModelAttributes to empty $jsonModelAttributeCache during ->refresh()
The vast majority of our unit tests use
$model = $model->fresh()which creates a brand new instance of the Model object in memory, all caches are by definition reset. The Laravel method$model->refresh()superficially looks the same but it's zeroing out all the caches base Laravel knows about, and doesn't catch our new$jsonModelAttributeCache.Add support in HasJsonModelAttributes to empty
$jsonModelAttributeCacheduring->refresh()