OP, when you stop saying things like "PHP (yuck)" and start to appreciate each language for the one (or more) things it got right, you'll be well on the way to taking your coding skills to expert.
It sounds like the OP is comfortable with the syntax for unit tests in their language of preference and that they need help learning the logic of “what they should be testing” to test the cases they mentioned. IMO this type of question is 99.9% syntax agnostic. In this case, they should look to an ecosystem where similar questions are asked to find examples of testing similar logics.
In this case, though the OP prefers a different language, I would guess tha there have been _many, many, many_ examples of php based projects which have unit tests and need to test interfaces to DBs and REST apis. Php is a relatively old ecosystem in terms of internet application programming and has a HUGE user base. So probably there are many good informal examples in larger Open source projects.
Like the parents last comment “read as much code as you can”!
Second, expertise in our field comes from years and years of practice. Mentorship helps to an extent, but you'll still have to put in the time.
Third, read as much code as you can.