PHPUnit contains an assertEquals() method, but it also has an assertSame() one. At first glance it looks like they do the same thing.
What is the difference between the two? Why are they both specified?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I use both sporadically, but according to the docs:
assertSameAnd as you can see in the example below the above excerpt, they are passing
'2204'and2204, which will fail usingassertSamebecause one is astringand one is anint,basically:assertEqualsassertEqualsdoes not appear to take datatype into consideration so using the above example of2204:I just ran some unit tests against the above examples, and indeed they resulted in documented behavior.