Questions about the PHPUnit assertion
Please use PHPUnit test or other framework to test, they have a lot of assertion way,
But what happens if testers use Asserttrue to implement assertions?
I want the test to work and determine if it's consistent with the assertion.
But the details of the impact may appear in the resulting report and cannot express the assertion result.
For example, to assert whether an array has an AB key, use the
Asserttrue (Isset ($arr [' AB ']))
But according to the official assertion method should be used
Assertarrayhaskey ($arr [' AB '])
Here are some typical examples:
Asserttrue ($x ==1)
Asserttrue (Is_array ($x))
Asserttrue (Empty ($x));
Asserttrue (Is_object ($x));
Asserttrue (count ($x) = = 100);
Look at the total feeling where something is wrong, if it can be true to solve seemingly no problem, but in fact Xunit system testing Framework provides so many assertions method?
What happens if you use true to assert the consequences?
------to solve the idea----------------------
For a more intuitive look at what's wrong
Here's a two-sheet contrast chart. It's true to assert that you can quickly locate a problem in that place?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.