From 789b403122567e09b7ad82a0c9baa87ea9fe2eea Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 20 Jan 2024 23:09:00 +0000 Subject: [PATCH] Add daily email for 2024-01-20 PHPUnit or Pest? --- source/_daily_emails/2024-01-20.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 source/_daily_emails/2024-01-20.md diff --git a/source/_daily_emails/2024-01-20.md b/source/_daily_emails/2024-01-20.md new file mode 100644 index 000000000..f7af33efd --- /dev/null +++ b/source/_daily_emails/2024-01-20.md @@ -0,0 +1,26 @@ +--- +title: PHPUnit or Pest? +date: 2024-01-20 +permalink: archive/2024/01/20/phpunit-or-pest +snippet: | + Which testing framework do you prefer? PHPUnit or Pest? +tags: + - software-development + - automated-testing + - test-driven-development + - php +--- + +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.