'PHPUnit how to test for two conditions
I am new to using PHPUnit, I found out that it is easy to test if given value is desired one using assertEquals function but I am not sure how to test for values with more than one condition such as:
function myFunction($foo, $bar, $baz)
{
if (($foo != 3) AND ($foo != 5)) {
// something
}
if (($bar < 1) OR ($bar > 10)) {
// something
}
if ( (strlen($baz) === 0) OR (strlen($baz) > 10) ) {
// something
}
}
Can anyone help on how to write unit test for these conditions please ? Thanks for your help in advance
Solution 1:[1]
Take a look at the assertThat method.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Illya Moskvin |
