I don't know if this is a too localized question, but I don't know what I should be unit testing with PHPUnit. Like for example on a simple user registration/login system, what should I be testing?
I hope you understand what I meant and enlighten me.
PHPUnit is a unit testing suite, hence the name. Unit testing is, by definition, writing tests for each unit -- that is, each class, each method -- as separately as possible from every other part of the system. Each thing users could use, you want to try to test that it -- and only it, apart from everything else -- functions as specified.
Basically, you want to test each public (and possibly protected) method that can possibly fail. If your inner hacker is wondering "hmm...if i called this function like this, would it break?", then write a test that asserts that it doesn't. Just be careful that you're isolating the component you're testing; otherwise, you just have a bunch of tests that fail but don't give you a clue as to where the real problem is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With