phplaravelphpunitphp-pestpestphp

Difference assertions and expectations in PEST (PHP)


I am starting to use PEST in my Laravel-project. I started to read the documentation and saw that both assert and expect exists but I see no real explanation on their difference.

Can someone please tell me the difference and when to use what?


Solution

  • Late, but not too late for future visitors.

    Assertion is the API from PHPUnit and also works in PEST. Expectation is the new API from PEST.

    So in PEST you can use both $this->assertXY() and expect()->toBeXY()