Search code examples
phpunit-testingphpunitequalitytriple-equals

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


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


Solution

  • 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).