Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The reason behind is that Laravel 6.18.35 & 7.24.0 introduced a security improvement that prevents from mass assigning non-db fields to an Eloquent model. The implementation is holding a reference to the list of the table fields in the newly introduced `guardableColumns` static property. It gets populated with the fields from the db for the first time a mass assignment happens on a model. In our tests, we add fields to the cart_items table during testing. If we hit the model first with the original amount of fields, the second call - having the new fields in the underlying table - won't repopulate the `guardableColumns` static property - for obvious reasons. However, there's no facility to reset this list, therefore we can't reboot this property of a model within a single run of a PHP process (namely tests). A dirty fix was to move the test with the extended number of columns ahead, thus those columns will be populated. Cheap fix, but actually in a real application it's not the case, it's only causing problems with testing. Thus, we get away with it. We have more important stuff to take care of ;) - See: https://blog.laravel.com/security-release-laravel-61835-7240 - See: laravel/framework#33777
- Loading branch information