Difference between assertEquals and assertSame in PHPUnit?

后端 未结 7 1147
别那么骄傲
别那么骄傲 2021-01-30 18:54

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

7条回答
  •  既然无缘
    2021-01-30 19:52

    $this->assertEquals(3, true);
    $this->assertSame(3, true);
    

    The first one will pass!

    The second one will fail.

    That is the difference.

    I think you should always use assertSame.

提交回复
热议问题