basic unit testing help |
[eluser]dadamssg[/eluser]
can anyone help me understand the basics of unit testing? I have set up this test controller to do the testing on my model with the one function, just to start understanding. So right now the test is returning that it passes, great. Would that be the only test i need to write for that function since it only has the possibility of returning true or false...just check is_bool? And obviously those inputs i have made when i made referencing the model function are inputs i EXPECT to see(strings not arrays, or integers or a bool value, etc). Is that how you do unit testing? just write simple tests that take what you expect to be inputted, in this case an email and password(both strings) and test what you want to outputted(boolean, arrays, integers, etc.)? If that's the case can you give me a scenario in which this simple test would benefit me? i'm having a hard time envisioning a scenario in which a unit test would come in handy Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); and my model Code: <?php
[eluser]dadamssg[/eluser]
now i've learned that using the real database is bad practice, wtf. I'm suppose to use "mock" data but how the hell do you incorporate that into your actual functions? |
Welcome Guest, Not a member yet? Register Sign In |