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 t
As it's been said before,AssertSame
reports an error if the two elements do not share type and value but it's also important to note this from the docummentation:
Reports an error identified by $message if the two variables $expected and $actual do not reference the same object.
So this test would fail too even though they share type and value:
class SameTest extends TestCase
{
public function testFailure()
{
$this->assertSame(new stdClass, new stdClass);
}
}