Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pest: bring back the joy of testing in PHP

Pest: bring back the joy of testing in PHP

A brief introduction to Pest: the new PHP testing framework with a focus on simplicity

Claudio La Barbera

June 01, 2023
Tweet

More Decks by Claudio La Barbera

Other Decks in Programming

Transcript

  1. Bring back the joy of testing in PHP Tech and

    Beer #2, 31st May 2023 Sponsored by
  2. { “name”: “Claudio La Barbera”, “role”: “Full Stack Developer”, “company”:

    “Angelini Consumer”, “linkedin”: “https://www.linkedin.com/in/claudio-la-barbera”, “github”: “https://github.com/thebatclaudio” }
  3. What is PEST? Pest is a testing framework with a

    focus on simplicity, meticulously designed to bring back the joy of testing in PHP. pestphp.com
  4. PEST is built on top of PHPUnit! Your current PHPUnit

    test suite will work flawlessly with Pest. No need to change a thing.
  5. Installation composer require pestphp/pest --dev --with-all-dependencies First step: require Pest

    as a “dev” dependency on your project: Second step: initialize Pest on your project: ./vendor/bin/pest --init Finally: you can run your tests: ./vendor/bin/pest php artisan test If you are using Laravel you can also run:
  6. Demo We will integrate Pest on a simple Laravel project

    that expose some APIs. https://github.com/thebatclaudio/bat-tasks
  7. In conclusion, Pest: • is easy to use • is

    easy to learn • is easy to read • make easy to migrate from PHPUnit • has a growing community and frequent updates