DEV Community

Oliver Davies
Oliver Davies

Posted on • Originally published at oliverdavies.uk on

PHPUnit or Pest?

A recent discussion has started about which testing framework should be the default one used in Laravel.

PHPUnit or Pest.

I've used both, and I like both.

I'm more familiar with classes, object-orientated code and PHPUnit, but for people who are more familiar with JavaScript and the Jest testing framework, Pest may be the better option.

Its expectation API, where you can chain multiple assertions on the same expectation, is helpful, although I don't mind some repetition in PHPUnit tests.

Pest tests can become abstract, especially with some of their one-line example tests.

Whether you pick PHPUnit, Pest or another framework like Behat or Codeception, the main thing is you're taking the time to write automated tests for your code, which is valuable whichever testing tool you use.

P.S. Are you still using Drupal 7 and don’t know what’s involved to upgrade to Drupal 10? Book a Drupal 7 upgrade consultation call or an upgrade roadmap.

Top comments (0)