gletsos's avatar

Should you test if a related model (parent) has also been changed in the database?

Hello, let's say when you're building nested resources (like Photos with Comments in Laravel docs) and you are about to write feature tests for hitting the endpoints of GET / POST /photos/{photo}/comments: alongside checking that the correct changes have been made to the child (Comment) in the database, would you also check that nothing has changed about the parent (Photo) in the database as well?

0 likes
3 replies
tykus's avatar

Why would anything change in the parent?

gletsos's avatar

@tykus I guess by accident because the child has access to the parent through Eloquent. Maybe I'm overthinking it?

Please or to participate in this conversation.