Yii provides an empty
UserTest class for us, so we're going to start working from there. Head over to
tests/codeception/unit/models/ and open the
So now our question is: what are we going to implement at this point? Well, the answer will be quite simple, once we've understood what the aim of the unit tests is.
Unit tests, as well as functional and acceptance tests, are a black box testing system: The tests will simply use the interface provided by the object and will make sure that the outputs are as expected. Since the implementation doesn't count if this changes slightly, or even radically, the tests should still pass assuming the interface remained the same.
White box testing, which is provided ...