18

How do I do a ===/strict equals comparison in phpunit?

madth3
  • 7,275
  • 12
  • 50
  • 74
Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539

1 Answers1

26

Use assertSame. It checks that the type and value are the same.

For objects, this will check that they "reference the same object" (object identity).

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
  • 1
    What is the functions that can compare two different objects, but with exactly the same poperties? Like `assertSame()`, that checks everything excep for the reference. – Danon Apr 15 '20 at 23:26