What is the difference between assertEquals and assertSame?

0

For when I check for example in the unit tests that a user did not create assertEquals(0,User::count) or assertSame(0,User::count)

    
asked by Paul Valencia 11.10.2018 в 13:14
source

1 answer

0

The fundamental difference is that'assertEquals' responds to result checks, not type. AssertSame checks in addition to the value, of the associated type. If you check a string that contains a number, against an integer, assertEquals can return true. AssertSame would check the type, and return false.

assertEquals:   devolveria true si compruebas algo tipo '5' == 5.
assertSame:     devolveria false, porque los tipos no coinciden

reference in stackoverflow: link

    
answered by 11.10.2018 в 13:19